1 solutions

  • 0
    @ 2025-11-5 15:50:18

    C :

    #include<stdio.h>
    #include<string.h>
    int main()
    {
    	int a=0,b=0,c=0,d=0,i,l;
    	char x[1001];
    	gets(x);
    	l=strlen(x);
    	for(i=0;i<l;i++)
    	{
    		if(x[i]>='A'&&x[i]<='Z')	a++;
    		else	if(x[i]>='a'&&x[i]<='z')	b++;
    		else	if(x[i]>='0'&&x[i]<='9')	c++;
    		else	if(x[i]>=' ')	d++;
    	}
    	printf("%d %d %d %d",a,b,c,d);
    }
    
    • 1

    【设计型】第10章: 字符串 10.21 字符统计

    Information

    ID
    17232
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By