字符串--hdu--3783--ZOJ

/*
    Name: 字符串--hdu--3783--ZOJ
    Author: shen_渊 
    Date: 17/04/17 20:58
    Description: 明天开始刷字符串的题,先来道水题 
*/
#include<cstring>
#include<iostream> 
using namespace std;
int ct[27];
int main(){
    string str;
    while(cin>>str){
        memset(ct,0,sizeof(ct));
        if(str == "E")break;
        else for(char ch:str)ct[ch-'A'+1]++;
        int z = ct[26],o = ct[15],j = ct[10];
        while(z>0 || o>0 || j>0){
            if(z>0)cout<<"Z";z--;
            if(o>0)cout<<"O";o--;
            if(j>0)cout<<"J";j--;
        }
        cout<<endl;
    }
    return 0;
}
原文地址:https://www.cnblogs.com/slothrbk/p/7251874.html