Panagrams
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include<ctype.h>
#define MAX 1000000
int main() {
char str[MAX];
scanf("%[^\n]",str);
int check=0,hash[26];
memset(hash,0,sizeof(hash));
for(int i=0;i<strlen(str);i++){
if(str[i]>='a' && str[i]<='z' || str[i]>='A' && str[i]<='Z'){
if(islower(str[i])){
if(hash[str[i]-'a']==0)
check++;
hash[str[i]-'a']=1;
}
else{
if(hash[str[i]-'A']==0)
check++;
hash[str[i]-'A']=1;
}
}
}
if(check==26)
printf("pangram");
else
printf("not pangram");
return 0;
}
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include<ctype.h>
#define MAX 1000000
int main() {
char str[MAX];
scanf("%[^\n]",str);
int check=0,hash[26];
memset(hash,0,sizeof(hash));
for(int i=0;i<strlen(str);i++){
if(str[i]>='a' && str[i]<='z' || str[i]>='A' && str[i]<='Z'){
if(islower(str[i])){
if(hash[str[i]-'a']==0)
check++;
hash[str[i]-'a']=1;
}
else{
if(hash[str[i]-'A']==0)
check++;
hash[str[i]-'A']=1;
}
}
}
if(check==26)
printf("pangram");
else
printf("not pangram");
return 0;
}
Comments
Post a Comment