define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
#include

int getstrcount01(char ch)
{
int i = 0;
int count = 0;
while (ch[i])
{
if (ch[i] != ‘ ‘)
{
count++;
}
i++;
}
return count;
}
int getstrcount(char
ch)
{
int count = 0;
while (ch)
{
if (
ch != ‘ ‘)count++;
ch++;
}
return count;
}
int main1()
{
char ch[] = “ hello world “;
int len = getstrcount(ch);
printf(“%d\n”, len);
return 0;
}

int main()
{
//统计字符串出现次数
char ch[] = “he1loworldnichoushachounizadizaichouyigeshishi”;//97 97+26
//存储字符串出现次数
int arr[26] = { 0 };
for (int i = 0; i < strlen(ch); i++)
{
arr[ch[i] - ‘a’]++;
}
for (int i = 0; i < 26; i++)
{
if(arr[i])
printf(“字母:%c出现次数:%d\n”, i + ‘a’, arr[i]);
}
return 0;
}