Alice wrote a sequence of words in CamelCase as a string of letters, , having the following properties:
C-code:
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int i=1,j;
char* s = (char *)malloc(10240 * sizeof(char));
scanf("%s",s);
for(j=0;s[j];j++)
{
if(s[j]>=65&&s[j]<=90)
i++;
}
printf("%d",i);
return 0;
}
- It is a concatenation of one or more words consisting of English letters.
- All letters in the first word are lowercase.
- For each of the subsequent words, the first letter is uppercase and rest of the letters are lowercase.
Input Format
A single line containing string .
Constraints
Output Format
Print the number of words in string .
Sample Input
save Changes In The Editor
Sample Output
5
Explanation
String contains five words:- save
- Changes
- In
- The
- Editor
C-code:
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(){
int i=1,j;
char* s = (char *)malloc(10240 * sizeof(char));
scanf("%s",s);
for(j=0;s[j];j++)
{
if(s[j]>=65&&s[j]<=90)
i++;
}
printf("%d",i);
return 0;
}
No comments:
Post a Comment