首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

9度OnlineJudge之1032:ZOJ

2013-09-28 
九度OnlineJudge之1032:ZOJ题目描述: #include iostream#include stringusing namespace stdint main

九度OnlineJudge之1032:ZOJ

题目描述: #include <iostream>#include <string>using namespace std;int main(){string str;while(cin>>str,str!="E"){int a=0,b=0,c=0;for(string::iterator it=str.begin();it!=str.end();++it){if(*it=='Z') ++a;if(*it=='O') ++b;if(*it=='J') ++c; } int total = a+b+c; for (int i=0;i<total;++i) { if(a>0) { cout<<"Z"; --a; } if(b>0) { cout<<"O";--b; } if (c>0) { cout<<"J"; --c; } }cout<<endl; }//system("PAUSE");return 0;}


热点排行