杭电acm1860
2015-10-26 14:15
239 查看
#include <stdio.h>
int main() {
char d1[6];
char c;
int book[6];
int ids, i;
while(~scanf("%c", &c) && c!='#') {
ids = 0;
for(i=0; i<6; i++)
book[i] = 0;
while(c != '\n') {
//printf("\n error1 \n");
d1[ids++] = c;
//printf("\n error12 %c error\n", d1[ids-1]);
scanf("%c", &c);
//printf("\n error13 \n");
}
while(scanf("%c", &c)) {
if(c == '\n')
break;
//printf("\n error2 \n");
for(i=0; i<ids; i++)
if(c == d1[i])
book[i] ++;
}
for(i=0; i<ids; i++)
printf("%c %d\n", d1[i], book[i]);
}
return 0;
}
int main() {
char d1[6];
char c;
int book[6];
int ids, i;
while(~scanf("%c", &c) && c!='#') {
ids = 0;
for(i=0; i<6; i++)
book[i] = 0;
while(c != '\n') {
//printf("\n error1 \n");
d1[ids++] = c;
//printf("\n error12 %c error\n", d1[ids-1]);
scanf("%c", &c);
//printf("\n error13 \n");
}
while(scanf("%c", &c)) {
if(c == '\n')
break;
//printf("\n error2 \n");
for(i=0; i<ids; i++)
if(c == d1[i])
book[i] ++;
}
for(i=0; i<ids; i++)
printf("%c %d\n", d1[i], book[i]);
}
return 0;
}
相关文章推荐
- java并发库之Executors常用的创建ExecutorService的几个方法说明
- unity3d 调用Start 注意
- 二叉树的实现
- C#字符串格式化(摘抄的,留下来用用)
- void指针(void *的用法)
- draw9patch.bat打不开的解决办法(绝对能解决)
- c语言 转义符 算术运算符及赋值运算符 复合运算符 逗号运算式和表达式 关系运算符 逻辑运算符
- 3.数据存储
- iOS之C语言指针,数组小结
- fatal: read error: Connection reset by peer
- python Synchronization between processes
- 调用bat文件执行java文件
- 2.ui
- HTTP 请求未经客户端身份验证方案“Anonymous”授权。
- checkbox的样式
- android-java与C++互调/对接SDK
- Codeforces Round #327 (Div. 2) (A. Wizards' Duel 简单数学)
- EL表达式之sessionScope
- 隐式Intent
- Android开发之如何保证Service不被杀掉(broadcast+system/app)