#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
const int N = 1000 + 10;
int main()
{
char buf[N];
#ifndef ONLINE_JUDGE
freopen("e:\\uva_in.txt", "r", stdin);
#endif
while (gets(buf)) {
if (strcmp(buf, "E") == 0)
break;
string s = buf;
int zcnt = count(s.begin(), s.end(), 'Z');
int ocnt = count(s.begin(), s.end(), 'O');
int jcnt = count(s.begin(), s.end(), 'J');
for (int i = 0; i < zcnt || i < ocnt || i < jcnt; i++) {
if (i < zcnt)
printf("Z");
if (i < ocnt)
printf("O");
if (i < jcnt)
printf("J");
}
printf("\n");
}
return 0;
}
题目1032:ZOJ
最新推荐文章于 2019-02-01 15:42:32 发布