UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#167263#984. 统计字符struct1000ms1228kbC++269b2023-01-01 22:27:152023-01-01 22:27:18

answer

#include<bits/stdc++.h>
#include<string>
#include<iomanip>
using namespace std;
int b[26];
int main(){
	string a;
	cin>>a;
	for(int i=0;a[i]!='#';i++){
		b[a[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(b[i]!=0)cout<<char(i+'a')<<':'<<b[i]<<'\n';
	}
}



详细

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

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: 1228kb

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