You are viewing a single comment's thread. Return to all comments →
create array storing characters a-z & A-Z compare with string char if match store 1 in another array check finally ur sum is 26 or not
string s; int sum =0; vector a(26,0); vector b(26); vector c(26);
for(int i=0;i<26;i++){ b[i]='a'+i;}
for(int i=0;i<26;i++){ c[i]='A'+i;}
getline(cin,s); for(int i=0;i<s.length();i++){ for(int j=0;j<26;j++){ if(s[i]==b[j] || s[i]==c[j]){ a[j]=1; } } } for(int i : a){ sum=sum+i; } if(sum==26) cout << "pangram"; else cout << "not pangram";
Seems like cookies are disabled on this browser, please enable them to open this website
Pangrams
You are viewing a single comment's thread. Return to all comments →
create array storing characters a-z & A-Z compare with string char if match store 1 in another array check finally ur sum is 26 or not
string s; int sum =0; vector a(26,0); vector b(26); vector c(26);
for(int i=0;i<26;i++){ b[i]='a'+i;}
for(int i=0;i<26;i++){ c[i]='A'+i;}