杭电1219
2016-03-08 11:12
274 查看
题目描述:
Ignatius is doing his homework now. The teacher gives him some articles and asks him to tell how many times each letter appears.
It's really easy, isn't it? So come on and AC ME.
水题,注意格式,直接AC:
using System;
namespace a1
{
class Program
{
public static void Main(string[] args)
{
string str = string.Empty;
while((str = Console.ReadLine())!=null){
int[] a=new int[26];
for(int i=0;i<26;i++)
a[i]=0;
char[] ch=str.ToCharArray();
for(int i=0;i<str.Length;i++)
if(ch[i]>='a' && ch[i]<='z') a[ch[i]-'a']++;
for(int i=0;i<26;i++)
Console.WriteLine((char)('a'+i)+":"+a[i]);
Console.WriteLine();
}
}
}
}
Ignatius is doing his homework now. The teacher gives him some articles and asks him to tell how many times each letter appears.
It's really easy, isn't it? So come on and AC ME.
水题,注意格式,直接AC:
using System;
namespace a1
{
class Program
{
public static void Main(string[] args)
{
string str = string.Empty;
while((str = Console.ReadLine())!=null){
int[] a=new int[26];
for(int i=0;i<26;i++)
a[i]=0;
char[] ch=str.ToCharArray();
for(int i=0;i<str.Length;i++)
if(ch[i]>='a' && ch[i]<='z') a[ch[i]-'a']++;
for(int i=0;i<26;i++)
Console.WriteLine((char)('a'+i)+":"+a[i]);
Console.WriteLine();
}
}
}
}
相关文章推荐
- 启动和停止应用程序进程
- K短路
- Power of Three
- 顺序存储结构的插入与删除
- Java多线程
- 数据库怎么设置代码折叠?
- 2015 年最棒的 5 个 HTML5 框架
- 纯css实现close - ×
- 如何得到WAV文件播放的总时间
- 【转】MyBatis学习总结(四)——解决字段名与实体类属性名不相同的冲突
- 分享牛人
- hive写入Elasticsearch参数设置
- C++ lambda表达式
- 集训队专题(8)1001 Biorhythms
- RxJava 多线程控制
- 对象数组
- Android Http 助手类(麻雀虽小),实现文件上/传下载,Cookie机制
- 关于心跳包
- pycharm快捷键、常用设置、配置管理
- 解决CE6和CE5在Platform Builder的Connectivity Options上的冲突