hshxjjnnn.hajhshhajsjsjsjsjsjxmdmdndb
char ch[N]
cin>>ch [],
只能一個個字符遍歷,然後記錄下每個字符出現的次數
#include<iostream>
#include <stdio.h>
#include <ctype.h>
using namespace std;
int main(){
int a[26]={0};
int i;
char c;
while ((c=getchar())!='\n')
if (isalpha(c))
a[tolower(c)-'a']++;
for (i = 0; i<26; i++) {
printf("%c\t:\t%d\n",'a'+i,a[i]);
}
system("pause");
}