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 test(s)
input
12toosmallword
output
NO
input
35TheQuickBrownFoxJumpsOverTheLazyDog
output
YES大意:只要简单排序,统计与原来字母表多少一样的就行
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main() { char s[105],s2[30] = {"abcdefghijklmnopqrstuvwxyz"}; int n; while(~scanf("%d",&n)){ getchar(); scanf("%s",s); for(int i = 0; i < n ; i++) if(s[i] >=‘A‘&&s[i] <= ‘Z‘) s[i] = s[i] - ‘A‘ + ‘a‘; sort(s,s+n); int count = 0; for(int i = 0; i < n ; i++){ if(s[i] == s2[count]) count++; } if(count == 26) printf("YES\n"); else printf("NO\n"); } return 0; }