Hacker Earth Problems - Complete String
Problem Statement:
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.
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”
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
1 <= N <= 10
The length of the string is at max 100 and the string contains only the characters a to z
Time Limit: 3 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Solution:
Language: Python
a=”abcdefghijklmnopqrstuvwxyz”
t=input()
while (t>0):
t-=1
b=raw_input()
if a == ”.join(sorted(“”.join(set(b)))):
print (“YES”)
else:
print (“NO”)
t=input()
while (t>0):
t-=1
b=raw_input()
if a == ”.join(sorted(“”.join(set(b)))):
print (“YES”)
else:
print (“NO”)
Comments
Post a Comment