Problem F: 零起点学算法101——统计字母数字等个数
#include<stdio.h>
#include<string.h>
int main(){
char str[];
while(gets(str)!=NULL){
int a=,b=,c=,d=;
for(int i=;str[i]!='\0';i++){
if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z')){
a++;
}
else if(str[i]>=''&&str[i]<=''){
b++;
}
else if(str[i]==' '){
c++;
}
else{
d++;
}
}
printf("%d %d %d %d\n",a,b,c,d);
}
return ;
}
Problem F: 零起点学算法101——统计字母数字等个数的更多相关文章
- 武汉科技大学ACM :1003: 零起点学算法67——统计字母数字等个数
Problem Description 输入一串字符,统计这串字符里的字母个数,数字个数,空格字数以及其他字符(最多不超过100个字符) Input 多组测试数据,每行一组 Output 每组输出一行 ...
- Problem F: 零起点学算法85——数组中插入一个数
#include<stdio.h> int main() { ],b[]; while(scanf("%d",&n)!=EOF) { ;i<n;i++) ...
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- Problem K: 零起点学算法107——统计元音
#include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...
- Problem G: 零起点学算法106——首字母变大写
#include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...
- 武汉科技大学ACM :1005: 零起点学算法101——手机短号
Problem Description 大家都知道,手机号是一个11位长的数字串,同时,作为学生,还可以申请加入校园网,如果加入成功,你将另外拥有一个短号.假设所有的短号都是是 6+手机号的后5位,比 ...
- Problem Y: 零起点学算法21——摄氏温度转换
#include<stdio.h> int main() { float f,c; while(scanf("%f",&f)!=EOF) c=*(f-); pr ...
- Problem X: 零起点学算法22——华氏摄氏温度转换
#include<stdio.h> int main() { float f,c; while(scanf("%f",&f)!=EOF) c=*(f-); pr ...
- Problem O: 零起点学算法10——求圆柱体的表面积
#include<stdio.h> int main() { float r,h,pi; pi=3.1415926; scanf("%f %f",&r,& ...
随机推荐
- deepin安装metasploit
[1]安装metasploit 1.curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/tem ...
- Python 如何将字符串转为字典
在工作中遇到一个小问题,需要将一个 python 的字符串转为字典,比如字符串: user_info = '{"name" : "john", "ge ...
- C# 数组 随机 排序
]; ; i < ; i++) { arrInt[i] = i; } arrInt = arrInt.OrderBy(c => Guid.NewGuid()).ToArray<int ...
- JS函数和变量名称冲突
在JS中如果函数名与变量名冲突,JS是怎么执行的? <script> console.log(sum);//function sum(){} function sum(){} var su ...
- 动画基础--基于Core Animation(3)
参考:https://zsisme.gitbooks.io/ios-/content/ 前面的文章动画基础--基于Core Animation(1),动画基础--基于Core Animation(2) ...
- POJ-2594
Treasure Exploration Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 7035 Accepted: 2 ...
- z-index失效的情况
1.父标签 position属性为relative: 2.问题标签无position属性(不包括static): 3.问题标签含有浮动(float)属性. 4.问题标签的祖先标签的z-index值比较 ...
- Google的C++开源代码项
转:http://blog.csdn.net/wenrenhua08/article/details/40040903 v8 - V8 JavaScript EngineV8 是 Google 的 ...
- opencv c++基本操作
常用操作 imread imread (char *filename, int flag=1); 第二个参数,int类型的flags,为载入标识,它指定一个加载图像的颜色类型.可以看到它自带缺省值1. ...
- python安装numpy和scipy的资源
whl资源:注意python版本和位数. http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy