A - Pangram
Problem 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.
Examples
Input
12
toosmallword
Output
NO
Input
35
TheQuickBrownFoxJumpsOverTheLazyDog
Output
YES
解题思路:如果输入的字符串中包含26个字母,则输出"YES",否则输出"NO",水过。
AC代码:
1 #include<bits/stdc++.h> 2 using namespace std; 3 int main(){ 4 int n;cin>>n;getchar();map<int,bool> mp; 5 for(int i=0;i<26;++i)mp[i]=false; 6 char str[105];cin>>str; 7 for(int i=0;i<n;++i){ 8 if(str[i]>='A'&&str[i]<='Z')mp[str[i]-'A']=true; 9 if(str[i]>='a'&&str[i]<='z')mp[str[i]-'a']=true; 10 } 11 bool flag=false; 12 for(int i=0;i<26;++i) 13 if(!mp[i]){flag=true;break;} 14 if(flag)cout<<"NO"<<endl; 15 else cout<<"YES"<<endl; 16 return 0; 17 }