#include <iostream> #include <algorithm> #include <string> #include <cmath> #define maxn 10010 using namespace std; typedef struct Day{ string name;//保存最初的输入形式 string s1; double t; // string t; }D; D d[maxn]; bool cmp(D d1,D d2)//排序 { if(d1.t!=d2.t)return d1.t<d2.t; return d1.s1<d2.s1; } double StoF(string s)//string->float { double ans=0; int pos; for(int i=0;i<s.size();i++) { if(s[i]=='.'){ pos = i; break; } else{ ans = ans*10+s[i]-'0'; } } ans = ans +0.1*(s[pos+1]-'0'); ans = ans +0.01*(s[pos+2]-'0'); ans = ans +0.001*(s[pos+3]-'0'); return ans; } int main() { string s; int len=0; while(getline(cin,s)) { if(s=="\n")break; d[len].name = s; int pos = s.find('-'); int pos1 = s.find(','); string sub = s.substr(pos-4,pos1-pos+8);//截取日期时间 d[len].s1= sub; // cout<<d[len].s1<<endl; pos = pos1+4; sub = s.substr(pos); while(sub[0]==' ')sub.erase(0,1);//擦除多余空格 pos = sub.find('('); sub.erase(pos,3);//擦除(s) d[len].t = StoF(sub);//字符串string转化为float浮点型 // d[len].t=sub; // printf("%.3lf\n",d[len].t); len++; } sort(d,d+len,cmp); for(int i=0;i<len;i++)cout<<d[i].name<<endl; } // 64 位输出请用 printf("%lld")