# PROBLEM LINK: Contest Page | CodeChef

Author: Setter’s name

Tester: Tester’s name

Editorialist: Editorialist’s name

DIFFICULTY : EASY

Nill

# PROBLEM:

Did you know that the letter ‘E’ is the most often used letter in the English language? Here, you are given a phrase containing a bunch of letters and you are supposed to find out how many times the letter ‘E’ has repeated in this phrase.

# QUICK EXPLANATION:

Increment a counter variable whenever the letter ‘e’ is encountered in the given string.

# EXPLANATION:

Initialise a character variable with the value ‘e’. Input the string in a character array and iterate through all the characters of this string while checking if each character in this string is equal to the value stored in the character variable mentioned earlier. Whenever an equality is found, a counter variable is incremented by one. The final value of the counter variable after iterating through the string is the required value.

# SOLUTIONS:

Setter's Solution

using namespace std;

int main()

{

char str[100];

cin>>str;

char c=‘e’;

int count = 0;

for(int i = 0; str[i] != ‘\0’; i++)

{

if(str[i] == c)

count++;

}

cout<<count<<"\n";

return 0;

}

Tester's Solution

Same Person

Editorialist's Solution

Same Person