1043 输出PATest
作者:互联网
代码
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int main(){
char c;
map<char,int> mp;
mp['P']=0;
mp['A']=0;
mp['T']=0;
mp['e']=0;
mp['s']=0;
mp['t']=0;
while(cin>>c){
mp[c]++;
}
while(mp['P']+mp['A']+mp['T']+mp['e']+mp['s']+mp['t']>0){
if(mp['P']>0){
cout<<'P';
mp['P']--;
}
if(mp['A']>0){
cout<<'A';
mp['A']--;
}
if(mp['T']>0){
cout<<'T';
mp['T']--;
}
if(mp['e']>0){
cout<<'e';
mp['e']--;
}
if(mp['s']>0){
cout<<'s';
mp['s']--;
}
if(mp['t']>0){
cout<<'t';
mp['t']--;
}
}
return 0;
}
重点
map的使用
标签:1043,输出,include,cout,map,--,while,mp,PATest 来源: https://www.cnblogs.com/wodeblog1982/p/16459861.html