Codeforces Round #295 (Div. 2)——A——Pangram

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
12
toosmallword
output
NO
input
35
TheQuickBrownFoxJumpsOverTheLazyDog
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;
}
View Code

 

 
posted @ 2015-03-19 12:19  Painting、时光  阅读(257)  评论(0编辑  收藏  举报