HDU3783 ZOJ
程序员文章站
2022-03-31 12:38:21
2019-05-17 16:35:21 加油,加油,坚持,fightting ......
2019-05-17
16:35:21
加油,加油,坚持,fightting
#include <bits/stdc++.h> using namespace std; int main() { string a; while(cin >> a) { int z = 0; int o = 0; int j = 0; if(a[0] == 'e') { break; } for (int i = 0; i < a.length(); i++) { if(a[i] == 'z') { z++; } else if(a[i] == 'o') { o++; } else { j++; } } while(1) { if(z == 0 && o == 0 && j == 0) { break; } if(z != 0) { cout << 'z' ; z--; } if(o != 0) { cout << 'o'; o--; } if(j != 0) { cout << 'j'; j--; } } cout << endl; } return 0; }
推荐阅读