Answer:
#include <bits/stdc++.h>
using namespace std;
bool isPangram(string &s) //boolean function to check whether the string is pangram or not...
{
int a[26]={0};//initializing the array a with zero.
for(int i=0;i<s.length();i++)
{
if(s[i]>='A' && s[i] <= 'Z') //checking for uppercase letters..
{
a[s[i]-'A']++;
}
else if(s[i]>='a' && s[i] <= 'z')//checking for lowercase letters..
{
a[s[i]-'a']++;
}
}
for(int i=0;i<26;i++)//if any value of array a is zero then returning false.
{
if(a[i]==0)
return false;
}
return true;
}
int main() {
string s;
getline(cin,s);
bool b=isPangram(s);
cout<<b<<endl;
return 0;
}
Input:-
abcdefghijklmnopqrstuvwxy z
Output:-
1
Explanation:
Pangram string is a string that contains all the alphabetical letters form a to z.So the above program returns 1 if the string is Pangram and 0 if the string is not pangram.
I have used a function called isPangram of type boolean.In the function I have taken an array of size 26 and initialized it with 0.Then iterating over the string and updating the count in the array a.Then checking if any value in the array a is zero if it is then the answer is false else it is true.