UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#171353#984. 统计字符heyuzhen1000ms1228kbC++292b2023-06-22 21:52:292023-06-22 21:52:31

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
string s;
ll a[500]; 
int main(){
	cin >> s;
	for(ll i = 0;i < s.length();i++)
		if(s[i] == '#')break;
		else a[s[i]]++;
	for(char i = 'a';i <= 'z';i++)
		if(a[i])cout << i << ":" << a[i] <<"\n";
	return 0;
}


详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 33
Accepted
time: 0ms
memory: 1228kb

input:

aacdhjrsss#

output:

a:2
c:1
d:1
h:1
j:1
r:1
s:3

result:

ok 7 lines

Test #2:

score: 33
Accepted
time: 0ms
memory: 1224kb

input:

dljfgkldfjgldfglfgjdfjgfdjgdfjglfgj#

output:

d:6
f:8
g:8
j:7
k:1
l:5

result:

ok 6 lines

Test #3:

score: 33
Accepted
time: 0ms
memory: 1228kb

input:

woeurihixhnvirnvoeibovbivebveoivhievbvniocvniweyrvqirviviivievqooq#

output:

b:4
c:1
e:7
h:3
i:14
n:4
o:7
q:3
r:4
u:1
v:14
w:2
x:1
y:1

result:

ok 14 lines