3 qwe asd zxc
e q w a d s c x z
My Programming:
#include <iostream> #include <list> using namespace std;
int main() { list<char> listChar; string strInput; int nTotalNum; cin >> nTotalNum; while(nTotalNum--) { cin >> strInput; const char* cStr = strInput.c_str(); for(int i=0; i<strInput.size(); i++) { listChar.push_back(cStr[i]); } listChar.sort(); list<char>::iterator iElement = listChar.begin(); while(iElement != listChar.end()) { cout << *iElement << " "; iElement++; } cout << endl; listChar.clear(); }
return 0; }