HDU3783 ZOJ
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; }