zoukankan      html  css  js  c++  java
  • 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
    ");
               else printf("NO
    ");
        }
        return 0;
    }
    View Code
     
  • 相关阅读:
    Tomcat中有四种部署Web应用的方式
    解析Json和复合类型
    spring学习笔记001
    java环境变量
    如何下载JSTL
    servlet应用及知识点总结
    一文读懂微服务架构
    一个死锁的case
    如何在phpstorm中查看yaf框架源码
    Modify column Vs change column
  • 原文地址:https://www.cnblogs.com/zero-begin/p/4350026.html
Copyright © 2011-2022 走看看