文章

150

粉丝

0

获赞

524

访问

22.3k

头像
字母统计 题解:
P1292 上海交通大学机试题
发布于2026年1月29日 08:03
阅读数 151

#include<bits/stdc++.h>
using namespace std;
int main(){
	string str;
	while(cin >> str){
		int times[26] = {0};
		for(char c:str){
			if(c >= 'A' && c <= 'Z')
				times[c - 'A' + 0]++;	
		}	
		for(int i=0;i<26;i++){
			char k = i + 'A';
			cout << k << ":" << times[i] << endl;	
		}	
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发