CF Pangram
Pangram
time limit per test
2 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputA 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 test(s)
input
12
toosmallword
output
NO
input
35
TheQuickBrownFoxJumpsOverTheLazyDog
output
YES
题意为判断这句话里是否26个字母都出现过,没什么好说的。
1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <string> 5 #include <algorithm> 6 #include <cctype> 7 #include <queue> 8 using namespace std; 9 10 int main(void) 11 { 12 char s[105]; 13 bool vis[26] = {false}; 14 int n; 15 16 scanf("%d",&n); 17 scanf("%s",s); 18 for(int i = 0;s[i];i ++) 19 if(isupper(s[i])) 20 vis[s[i] - 'A'] = true; 21 else 22 vis[s[i] - 'a'] = true; 23 24 for(int i = 0;i < 26;i ++) 25 if(!vis[i]) 26 { 27 puts("NO"); 28 return 0; 29 } 30 puts("YES"); 31 return 0; 32 }