forked from vaibhavpathak999/Algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlipogram_checker.cpp
More file actions
42 lines (34 loc) · 964 Bytes
/
Copy pathlipogram_checker.cpp
File metadata and controls
42 lines (34 loc) · 964 Bytes
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
#include <iostream>
#include <string>
const std::string alphabets = "abcdefghijklmnopqrstuvwxyz";
void
panLipogramChecker(std::string phrase)
{
using std::cout;
using std::endl;
for (unsigned int i = 0; i < phrase.length(); i++)
phrase[i] = tolower(phrase[i]);
int counter = 0;
for (unsigned int i = 0; i < 26; i++)
{
auto pos = phrase.find(alphabets[i]);
if (pos > phrase.length())
counter += 1;
}
if (counter == 0)
cout << "Pangram" << endl;
else if (counter >= 2)
cout << "Not a pangram but might be a lipogram" << endl;
else
cout << "Pangrammatic Lipogram" << endl;
}
int
main()
{
std::string str = "The quick brown fox jumped over the lazy dog";
panLipogramChecker(str);
str = "The quick brown fox jumps over the lazy dog";
panLipogramChecker(str);
str = "The quick brown fox jum over the lazy dog";
panLipogramChecker(str);
}