-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPanagram Checking.cpp
53 lines (44 loc) · 1 KB
/
Panagram Checking.cpp
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
//{ Driver Code Starts
//Initial template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution
{
public:
//Function to check if a string is Pangram or not.
bool checkPangram (string s) {
// your code here
vector<int>freq(26,0);
for(int i=0;i<s.length();i++){
if((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z') ){
char ch=tolower(s[i]);
freq[ch-'a']++;
}
}
for(int i=0;i<26;i++){
if(freq[i]==0) return false;
}
return true;
}
};
//{ Driver Code Starts.
// Driver Program to test above functions
int main()
{
int t;
cin>>t;
cin.ignore(INT_MAX, '\n');
while(t--){
string s;
getline(cin, s);
Solution obj;
if (obj.checkPangram(s) == true)
cout<<1<<endl;
else
cout<<0<<endl;
}
return(0);
}
// } Driver Code Ends