Pangram(水题)

F - Pangram
Time Limit:2000MS    Memory Limit:262144KB    64bit IO Format:%I64d & %I64u
Submit Status

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 itat 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

Input
12
toosmallword
Output
NO
Input
35
TheQuickBrownFoxJumpsOverTheLazyDog
Output
YES

练习时候的代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cctype>

using namespace std;

int main()
{
    char s[110], a[27];
    int n, i;
    while( scanf("%d", &n) != EOF )
    {
        memset(s, 0, sizeof(s));
        memset(a, 0, sizeof(a));
        getchar();
        gets(s);
        if( n<26 )
        {
            printf("NO\n");
            continue;
        }
        for( i=0; i<n; i++ )
            a[tolower(s[i])-'a'] = 1;
        for( i=0; i<27; i++ )
            if( 0 == a[i] )
                break;
        if( 26 == i )
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}

这道题我不想说什么了,比赛时不明觉厉一直超时,最后实验室的一个小伙伴告诉我重写一遍就能过,最后是真的醉了,AQA

你可能感兴趣的:(Pangram(水题))