Problem Type : String
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,k,len,count;
char ch[1000];
while(gets(ch))
{
len=strlen(ch);
count=0;
for(i=0; i<len ; i++)
{
if(ch[i]>='A'&& ch[i]<='Z'&& ch[i+1]<65 || ch[i]>='a'&& ch[i]<='z'&&ch[i+1]<65)
{
count++;
}
if(ch[i]>='A'&& ch[i]<='Z'&& ch[i+1]>122 && ch[i+1]<127|| ch[i]>='a'&& ch[i]<='z'&&ch[i+1]>122 && ch[i+1]<127)
{
count++;
}
if(ch[i]>='A'&& ch[i]<='Z'&& ch[i+1]>90 && ch[i+1]<=96|| ch[i]>='a'&& ch[i]<='z'&&ch[i+1]>90 && ch[i+1]<=96)
{
count++;
}
else
continue;
}
printf("%d\n",count);
}
return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
int i,j,k,len,count;
char ch[1000];
while(gets(ch))
{
len=strlen(ch);
count=0;
for(i=0; i<len ; i++)
{
if(ch[i]>='A'&& ch[i]<='Z'&& ch[i+1]<65 || ch[i]>='a'&& ch[i]<='z'&&ch[i+1]<65)
{
count++;
}
if(ch[i]>='A'&& ch[i]<='Z'&& ch[i+1]>122 && ch[i+1]<127|| ch[i]>='a'&& ch[i]<='z'&&ch[i+1]>122 && ch[i+1]<127)
{
count++;
}
if(ch[i]>='A'&& ch[i]<='Z'&& ch[i+1]>90 && ch[i+1]<=96|| ch[i]>='a'&& ch[i]<='z'&&ch[i+1]>90 && ch[i+1]<=96)
{
count++;
}
else
continue;
}
printf("%d\n",count);
}
return 0;
}
No comments:
Post a Comment