📄 统计字符.txt
字号:
//test
#include <cstdio>
#include <string>
#include <cmath>
#include <stack>
#include <algorithm>
using namespace std;
int alph[300];
char str[300],str2[300];
void hash() {
int i;
for (i=0;str2[i];i++) {
alph[ str2[i] ] ++;
}
}
int main() {
int i;
while (gets(str)) {
if (str[0] == '#' && str[1] == 0) break;
memset(alph,0,sizeof(alph));
gets(str2);
hash();
for (i=0;str[i];i++) {
printf("%c %d\n",str[i],alph[ str[i] ]);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -