number of a-e

Input a series of characters, count the number of ‘a’ to ‘e’.

Input:
A series of characters end with enter. (<80)

Output:
The number of ‘a’ to ‘e’

Input sample:
I am busy but happy !
Output sample:
a(2)b(2)c(0)d(0)e(0)

#include<stdio.h>
int main()
{
	char s[80];
	gets(s);
	int a=0,b=0,c=0,d=0,e=0;
	for(int i=0;i<80;i++)
	{
		if(s[i]=='a')
		a++;
		if(s[i]=='b')
		b++;
		if(s[i]=='c')
		c++;
		if(s[i]=='d')
		d++;
		if(s[i]=='e')
		e++;
	}
	printf("a(%d)b(%d)c(%d)d(%d)e(%d)",a,b,c,d,e);
	return 0;
}
©️2020 CSDN 皮肤主题: 游动-白 设计师:上身试试 返回首页