#include<iostream> #include<stdio.h> #include<cstring> #include<map> using namespace std; int main() { string s; while (cin >> s) { map<char, int>m; m['Z'] = m['O'] = m['J']; //统计字频 for(int i = 0; i < s.length(); i++) { m[s[i]]++; } //按照ZOJ顺序输出 while(m['Z'] > 0 || m['O'] > 0 || m['J'] > 0) { if(m['Z'] > 0) cout << 'Z'; m['Z'] --;//一定要更新字频 if(m['O'] > 0) cout << 'O'; m['O'] --; if(m['J'] > 0) cout << 'J'; m['J'] --; } } return 0; }