Roy wanted to increase his typing speed for programming contests. So, his friend advised him to type the sentence "The quick brown fox jumps over the lazy dog" repeatedly, because it is a pangram. (Pangrams are sentences constructed by using every letter of the alphabet at least once.)
After typing the sentence several times, Roy became bored with it. So he started to look for other pangrams.
Given a sentence s, tell Roy if it is a pangram or not.
Input Format Input consists of a line containing s.
Constraints Length of s can be at most 103 (1≤|s|≤103) and it may contain spaces, lower case and upper case letters. Lower case and upper case instances of a letter are considered the same.
Output Format Output a line containing pangram if s is a pangram, otherwise output not pangram.
void panagram(char s[])
{
int num1[26]={0};
int num2[26]={0};
int len=strlen(s);
int count=0,j,i;
for(i=0;i<len;i++)
{
if(s[i]>=97&&s[i]<=122)
{
num1[s[i]-97]++;
}
if(s[i]>=65&&s[i]<=90)
{
num2[s[i]-65]++;
}
}
for(j=0;j<26;j++)
{
if(num1[j]>=1||num2[j]>=1)
{ printf("%d\t\t%d\n",num1[j],num2[j]);
count++;
}
}
printf("%d\t",count);
if(count>=26)
printf("panagram");
else
printf("not panagram");
}
int main() {
char s[1000];
scanf("%s",s);
panagram(s);
return 0;
}
The code works fine for strings without blank spaces like "Wepromptlyjudgedantiqueivorybucklesforthenextprize" but fails to work for strings with blank spaces - "We promptly judged antique ivory buckles for the next prize" Can anyone tell where I am going wrong? Am I taking input incorrectly?