/*
*/
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<ctype.h>
using namespace std;
int main(){
char temp;
int P,A,T,e,s,t;
P=A=T=e=s=t=0;
while(scanf("%c",&temp)!=EOF){
switch(temp){
case ‘P‘: P++;
break;
case ‘A‘: A++;
break;
case ‘T‘: T++;
break;
case ‘e‘: e++;
break;
case ‘s‘: s++;
break;
case ‘t‘: t++;
break;
}
}
while(P!=0||A!=0||T!=0||e!=0||s!=0||t!=0){
if(P!=0){
printf("P");
P--;
}
if(A!=0){
printf("A");
A--;
}
if(T!=0){
printf("T");
T--;
}
if(e!=0){
printf("e");
e--;
}
if(s!=0){
printf("s");
s--;
}
if(t!=0){
printf("t");
t--;
}
}
return 0;
}
原文地址:https://www.cnblogs.com/hebust/p/9498020.html
时间: 2024-10-07 09:22:02