#include <iostream> #include <sstream> #include <map> using namespace std; int main(){ string line; std::getline(cin,line); istringstream iss{line}; string str; map<int,string,std::greater<int>> res; int count = 0; while(iss>>str){ // 在对每个字符串进行处理 string temp; for(auto &ch:str){ if(isalnum(ch)){ temp += ch; }else{ if(!temp.empty()){ res.insert({count++,temp}); temp.clear(); } } } // 循环结束之后 if (!temp.empty()) { res.insert({count++, temp}); } } // 输出结果 for(auto &ele: res){ cout<<ele.second<<" "; } cout<<endl; return 0; }