-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1043.cpp
More file actions
63 lines (59 loc) · 981 Bytes
/
1043.cpp
File metadata and controls
63 lines (59 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
cin >> s;
int count[6] = { 0 };
for (int i = 0; i < s.length(); i++)//记录六个字符的个数
{
if (s[i] == 'P')
count[0]++;
else if (s[i] == 'A')
count[1]++;
else if (s[i] == 'T')
count[2]++;
else if (s[i] == 'e')
count[3]++;
else if (s[i] == 's')
count[4]++;
else if(s[i]=='t')
count[5]++;
}
do//按照PATest的顺序输出,每输出一个总数就减一,如果个数为0就不输出了
{
if (count[0] != 0)
{
cout << "P";
count[0]--;
}
if (count[1] != 0)
{
cout << "A";
count[1]--;
}
if (count[2] != 0)
{
cout << "T";
count[2]--;
}
if (count[3] != 0)
{
cout << "e";
count[3]--;
}
if (count[4] != 0)
{
cout << "s";
count[4]--;
}
if (count[5] != 0)
{
cout << "t";
count[5]--;
}
} while (count[0] != 0 || count[1] != 0 || count[2] != 0 || count[3] != 0 || count[4] != 0 || count[5] != 0);
cout << endl;
return 0;
}