forked from imdhanish/HackerEarth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComplete String.cpp
More file actions
61 lines (57 loc) · 1.18 KB
/
Complete String.cpp
File metadata and controls
61 lines (57 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
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
*/
#include <bits/stdc++.h>
using namespace std;
bool complete(string s)
{
//there is no point in checking string of length lesser than 26 if its complete
if(s.length()<26)
{
return false;
}
for(char ch = 'a'; ch <= 'z'; ch++)
{
//if any of the ch is not found return false
if(s.find(ch) == string::npos)
{
return false;
}
}
return true;
}
int main()
{
int tc;
string s;
cin>>tc;
while(tc--)
{
cin>>s;
if(complete(s))
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
return 0;
}