英语阅读挑战

英语阅读真是令人头痛的东西。可怜的子航想利用寒假时间突破英语难题。当他拿到一篇英语阅读时,他很好奇作者最喜欢用那些字母。

输入

一句30词以内的英语句子

输出

统计每个字母出现的次数

 

样例输入 复制

 

However,the British don't have a history of exporting their foodstuffs,which makes it difficult for restaurants in Hong Kong to source authentic ingredients.
样例输出 复制
a:6
b:1
c:4
d:4
e:12
f:7
g:4
h:10
i:13
k:2
l:1
m:1
n:9
o:12
p:1
r:10
s:9
t:15
u:5
v:2
w:2
x:1
y:1

 

#include <iostream>
#include <map>
#include <cctype>

using namespace std;

int main(){
	map<char,int>s;
	char c;
	do{
		cin >> c;
		if(isalpha(c)){
			c = tolower(c);
			s[c] ++;
		}
	}while(c != '.');
	for(map<char,int>::iterator iter = s.begin();iter !=s.end(); iter++)
		cout << iter->first << ":" << iter->second << endl;
	return 0;
}

相关推荐

  1. 英语阅读挑战

    2024-03-14 00:22:03       22 阅读
  2. 英语阅读文章

    2024-03-14 00:22:03       9 阅读
  3. 美式英语英式英语的不同之处

    2024-03-14 00:22:03       14 阅读
  4. 英文阅读~Why Trump won‘t stop suing the media and losing

    2024-03-14 00:22:03       14 阅读
  5. 程序员英语 - 英文会议常用句型

    2024-03-14 00:22:03       32 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-14 00:22:03       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-14 00:22:03       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-14 00:22:03       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-14 00:22:03       18 阅读

热门阅读

  1. 华为机试题-字符串压缩

    2024-03-14 00:22:03       20 阅读
  2. 测开面经学习笔记

    2024-03-14 00:22:03       18 阅读
  3. C++进阶学习

    2024-03-14 00:22:03       21 阅读
  4. 车规芯片为什么需要信息安全(2)

    2024-03-14 00:22:03       21 阅读
  5. 10个必知必会的SQL聚合函数

    2024-03-14 00:22:03       17 阅读
  6. Git命令(持续更新中...)

    2024-03-14 00:22:03       21 阅读
  7. C++:构造函数赋初值的几种形式

    2024-03-14 00:22:03       19 阅读