zoukankan      html  css  js  c++  java
  • quick brown box

    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"iostream"
    #include<string.h>
    using namespace std;
    #define N 101
    int main()
    {
    char str2[N],str3[N];
    int i,j,k,t,f,s;
    string str1="abcdefghijklmnopqrstuvwxyz";
    int n;
    scanf("%d",&n);
    getchar();
    for(s=0;s<n;s++)
    {
    t=0;
    f=0;
    memset(str2,0,101*sizeof(char));
    memset(str3,0,101*sizeof(char));

    gets(str2);
    for(i=0;str1[i]!='';i++)
    {
    for(j=0;str2[j]!='';j++)
    if((str1[i]==str2[j])||((str1[i]-32)==str2[j]))
    {
    f=1;
    for(k=0;k<=t;k++)
    {
    if(str3[k]==str1[i])
    break;
    }
    if(k>t)
    {
    str3[t]=str1[i];
    t++;
    break;
    }
    }
    }
    if(t==26)
    printf("pangram ");
    else
    {
    printf("missing ");
    j=0;
    for(i=0;i<26;i++)
    {
    if(str1[i]!=str3[j]){
    printf("%c",str1[i]);
    continue;
    }
    j++;
    }


    printf(" ");
    }
    }

    return 0;
    }

  • 相关阅读:
    asp.net core mvc 之 DynamicApi
    打造适用于c#的feign
    asp.net App_Code文件夹相关操作
    基于Mono.Cecil的静态注入
    补充ICache
    自制简单实用IoC
    自制简单的.Net ORM框架 (一) 简介
    解决Asp.net Mvc中使用异步的时候HttpContext.Current为null的方法
    微信开发之.Net
    VS2017 网站打包发布生成的文件中包含.pdb文件,解决办法
  • 原文地址:https://www.cnblogs.com/1023x/p/5576480.html
Copyright © 2011-2022 走看看