Description
A word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devices.
You are given a string consisting of lowercase and uppercase Latin letters. Check whether this string is a pangram. We say that the string contains a letter of the Latin alphabet if this letter occurs in the string in uppercase or lowercase.
Input
The first line contains a single integer n (1 ≤ n ≤ 100) — the number of characters in the string.
The second line contains the string. The string consists only of uppercase and lowercase Latin letters.
Output
Output "YES", if the string is a pangram and "NO" otherwise.
Sample Input
12 toosmallword
NO
35 TheQuickBrownFoxJumpsOverTheLazyDog
YES
#include <stdio.h>
#include <string.h>
int main()
{
int n,i,count=0;
char a[150];
int b[26]= {0};
scanf("%d",&n);
scanf("%s",a);
for(i=0; i<strlen(a); i++)
{
if(a[i]>='a'&&a[i]<='z')
b[a[i]-'a']=1;
if(a[i]>='A'&&a[i]<='Z')
b[a[i]-'A']=1;
}
for(i=0;i<26;i++)
count+=b[i];
if(count==26)
printf("YES");
else printf("NO");
return 0;
}
此题和上一个每日一题G一样 如果一遍一遍找太慢,就看看固定位置有没有这个东西(26字母位置是否都存在),存在设置为1,如果都存在 ,那么如果都存在就是26;输出YES ,否则输出NO;这个题我看不懂的地方就是 第一个输入完全没用。