Header Ads Widget

Complete String

Problem:-

A string is said to be complete if it contains all the characters from a to z. Given a string, check if it complete or not.
Input
First line of the input contains the number of strings N. It is followed by N lines each contains a single string.
Output
For each test case print "YES" if the string is complete, else print "NO"
Constraints
1 <= N <= 10
The length of the string is at max 100 and the string contains only the characters a to z
SAMPLE INPUT
 
3
wyyga
qwertyuioplkjhgfdsazxcvbnm
ejuxggfsts
SAMPLE OUTPUT
 
NO
YES
NO
Time Limit:3.0 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:1024 KB

solution:-

#include<stdio.h>
void main()
{
     int n,i,a[123],x,j;
     char s[100];
     scanf("%d",&n); 
     for(i=1;i<=n;i++)
     {
     for(j=97;j<123;j++)
     a[j]=0;
        scanf("%s",s);
        for(j=0;s[j];j++){
         x=s[j];
         a[x]++;
        }
        for(j=97;j<=122;j++)
         if(a[j]==0){
         printf("NO\n");
         break;
         }
         if(j==123)
         printf("YES\n");
     }
}

Post a Comment

0 Comments