题解 | #ZOJ#
ZOJ
https://www.nowcoder.com/practice/7557d470617c464f9200d93acf721471
#include <iostream> #include <vector> using namespace std; int main() { string str; cin>>str; vector<char> z,o,j; for(int i=0;i<str.size();i++){ if(str[i]=='Z') z.push_back(str[i]); else if(str[i]=='O') o.push_back(str[i]); else if(str[i]=='J') j.push_back(str[i]); } for(int i=0;i<z.size()||i<o.size()||i<j.size();i++){ if(i<z.size()) cout<<z[i]; if(i<o.size()) cout<<o[i]; if(i<j.size()) cout<<j[i]; } return 0; }