zoukankan      html  css  js  c++  java
  • Quick Brown Fox

    Quick Brown Fox时间限制: 1 Sec  内存限制: 128 MB

    题目描述

    A pangram is a phrase that includes at least one occurrence of each of the 26 letters, ‘a’. . .‘z’. You’re probably familiar with this one: “The quick brown fox jumps over the lazy dog.”
    Your job is to recognize pangrams. For phrases that don’t contain every letter, report what letters are missing. We’ll say that a particular letter occurs in the phrase if it occurs as either upper case or lower case.

    输入

    Input starts with a line containing an integer 1 ≤ N ≤ 50. The next N lines are each a single phrase,possibly containing upper and lower case letters, spaces, decimal digits and punctuation characters ‘.’,‘,’, ‘?’, ‘!’, ‘’’ and ‘"’. Each phrase contains at least one and no more than 100 characters.

    输出

    For each input phrase, output “pangram” if it qualifies as a pangram. Otherwise, output the word “missing” followed by a space and then the list of letters that didn’t occur in the phrase. The list of missing letters should be reported in lower case and should be sorted alphabetically.

    样例输入

    3
    The quick brown fox jumps over the lazy dog.
    ZYXW, vu TSR Ponm lkj ihgfd CBA.
    .,?!’" 92384 abcde FGHIJ
    

    样例输出

    pangram
    missing eq
    missing klmnopqrstuvwxyz


    #include<stdio.h>
    #include<string.h>
    int main()
    {
        char a[53],s[100];
        int i,j=0,n,count;
        int N;
        int book[26];
        for(i=0;i<26;i++)
        {
            a[i]='a'+i;
        }
        for(i=26;i<52;i++)
        {
            a[i]='A'+i-26;
        }
       printf("%c\n",a[51]);
       // puts(a);
       scanf("%d",&N);
       while(N--)
       {
           getchar();
           gets(s);
          n=strlen(s);
          for(i=0;i<26;i++)
            book[i]=0;
        for(i=0;i<n;i++)
        {
            for(j=0;j<52;j++)
            { if(s[i]==a[j]&&j<26)
                  book[j]++;
                  if(s[i]==a[j]&&j>=26)
                    book[j-26]++;
              }
        }
        for(i=0;i<26;i++)
        printf("%d ",book[i]);
        for(i=0;i<26;i++)
        {
            if(book[i]!=0)
                count++;
        }
        if(count==26)
            printf("pangram\n");

            if(count!=26)
            {
                printf("missing ");
            for(i=0;i<26;i++)
            {
                if(book[i]==0)
                printf("%c",a[i]);
            }
            printf("\n");
            }
       }
            return 0;
    }








  • 相关阅读:
    SuperSocket 1.4系列文档(16) 在SuperSocket中启用传输层加密(TLS/SSL)
    SuperSocket 1.4系列文档(10) SuperSocket中的日志功能
    UIPageControl实现自定义按钮
    ios 某些代码网址,app打包成ipa
    笔记隐藏状态栏,播放音乐,获取文件路径,nsthread,文件文件夹操作,plist 时间
    使用NSTimer实现倒计时,Iphone幻灯片效果+背景音乐,
    如何让你的iPhone程序支持多语言环境(本地化)
    iPhone电子书toolbar的实现
    iphone界面如何实现下拉列表
    使用NSTimer与iphone的简单动画,实现飘雪效果
  • 原文地址:https://www.cnblogs.com/AquamarineOnly/p/5573912.html
Copyright © 2011-2022 走看看