Description
全字母句 (pangram) 指包含字母表中全部 26 种英文字母(不区分大小写)的句子,其常被用于展示英文字体的显示效果。
现在,bLue 得到了很多句子,他想知道哪些句子是全字母句。
Input
输入数据有多组(数据组数不超过 100),到 EOF 结束。
每组数据包含一行长度不超过 100 的字符串。
Output
对于每组数据,输出一行。
如果是全字母句则输出 “Yes”,否则输出 “No”(不包括引号)。
Sample
Input
The quick brown fox jumps over the lazy dog.
The 6th ACM Funny Programming For/While Contest
Output
Yes
No
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include<stdio.h>
using namespace std;
char str[101];
int cnt[101]= {0};
int flag;
int main()
{
while(cin.getline(a,101))
{
flag=1;
//数组初始化为0,把大小写统一,并且计算大写字母出现次数
memset(cnt, 0, sizeof(cnt));
for (int i=0; str[i]!='\0'; i++)
{
if(str[i]>='a'&&str[i]<='z')
{
str[i]=str[i]-32;
}
else if(str[i]==' ')
{
continue;
}
cnt[int(str[i])]++;
}
//如果在过程中有字母没有出现,则非全字母语句
for (int i='A'; i<='Z'; i++)
{
if(cnt[i]==0)
{
flag=0;
}
}
if(flag==0)
{
printf("No\n");
}
else if(flag==1)
{
printf("Yes\n");
}
}
return 0;
}