# PANGRAM CHECK

## Check if the given string is Pangram or not.

Pangram : A sentence(string) containing every letter of the alphabet. (a to z)
(No case sensitivity)

### Examples

a) Input string : ”Pack my box with five dozen liquor jugs”
Output : is a pangram

b) Input string : ” Pack my box with dozen liquor jugs”
Output : is not a pangram
Because, f, i, v, e letters are missing in the input string.

Time complexity : O(n)

## Algorithm

1. Create a hast table(bool vector). To mark the characters present in the string.

2. Traverse all characters in the input string.

3. If uppercase character, subtract ‘A’ to find index.

4. If lower character, subtract ‘a’ to find index.

5. Mark the value in the vector as true.(present)

6. Return false if any character is unmarked.

7. Else, return true.

## C++ Program

```#include <bits/stdc++.h>

using namespace std;

//Panagram check
bool isPangram(string &input_string)
{
vector<bool> mark(26, false);//hash table to mark present or not
int index;
// Traverse all characters
for (int i=0; i<input_string.length(); i++)
{
if ('A' <= input_string[i] && input_string[i] <= 'Z')//lower case
{
index = input_string[i] - 'A';//subtracting 'A' to find index
}
else if('a' <= input_string[i] && input_string[i] <= 'z')//lower case
{
index = input_string[i] - 'a';//subtracting 'a' to find index
}
mark[index] = true;//mark current
}
//If any character is unmarked
for (int i=0; i<=25; i++)
{
if (mark[i] == false)
{
return false;
}
}
return true;// If a to z were present

}

//Main function
int main()
{
string input_string = "Pack my box with five dozen liquor jugs" ;
if (isPangram(input_string) == true)
{
cout<<"'"<<input_string.c_str()<<"' "<<"is a Pangram";
}
else
{
cout<<"'"<<input_string.c_str()<<"' "<<"is not a Pangram";
}
return 0;
}```