标签:
时间限制:1 秒
内存限制:32 兆
特殊判题:否
提交:6050
解决:3491
I THIS IS A TEST i ng this is a long test string #
I 2 i 3 5 n 2 g 2
继续用桶的思想,这种题目很简单!O(∩_∩)O哈哈~
//Asimple #include <iostream> #include <algorithm> #include <cstring> #include <cstdio> #include <cctype> #include <cstdlib> #include <stack> #include <cmath> #include <string> #include <queue> #define INF 100000 using namespace std; const int maxn = 105; typedef long long ll ; int n, m, num; char str[maxn], s1[6]; int a[128]; int main(){ while( gets(s1) != NULL ){ if( strlen(s1) == 1 && s1[0] == ‘#‘ ) break; memset(a,0,sizeof(a)); gets(str); for(int i=0; str[i]!=‘\0‘; i++){ a[str[i]] ++ ; } for(int j=0; s1[j]!=‘\0‘; j++){ printf("%c %d\n",s1[j],a[s1[j]]); } } return 0; }
标签:
原文地址:http://www.cnblogs.com/Asimple/p/5839532.html