1 solutions

  • 0
    @ 2025-3-3 16:33:59

    C :

    #include<stdio.h>
    #include<string.h>
    int main(){		
    	char s[1000];
    	gets(s);
    	int len=strlen(s),i,n=0;
    	for(i=0;i<len;i++){
    		if(s[i]>='A'&&s[i]<='Z'){
    			n++;
    		}
    		
    	}
    	printf("%d",n);
    	return 0; 
    	}
    

    Python :

    # coding=utf-8
    s = input()
    n = 0
    i = ord(s[n])
    c = 0
    while i != 46:
        if i >= 65 and i<= 90:
            c = c + 1
            n = n + 1
            i = ord(s[n])
             
        else:
            n = n + 1
            i = ord(s[n])
    print(c)
    
    • 1

    Information

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