Easy Pronunciation Codechef Solution | EZSPEAK | (100/100) FULL | Codechef July Lunchtime | AC Code
Words that contain many consecutive consonants, like “schtschurowskia
“, are generally considered somewhat hard to pronounce.
We say that a word is hard to pronounce if it contains
You are given a string YES
if it is easy to pronounce and NO
otherwise.
For the purposes of this problem, the vowels are the characters
Input Format
- The first line of input will contain a single integer
T , denoting the number of test cases. - Each test case consists of two lines of input.The first line of each test case contains a single integer
N , the length of stringS. - The second line of each test case contains the string
S
Output Format
For each test case, output on a new line the answer — YES
if
is easy to pronounce, and NO
otherwise.
Each character of the output may be printed in either uppercase or lowercase. For example, the strings YES
, yeS
, yes
, and YeS
will all be treated as identical.
Constraints
1≤T≤100 1≤N≤100 S contains only lowercase Latin characters, i.e, the characters{a,b,c,…,z}
Sample Input 1
5
5
apple
15
schtschurowskia
6
polish
5
tryst
3
cry
Sample Output 1
YES
NO
YES
NO
YES
Explanation
Test case
“
Test case
“
Test case
Test case
Test case
#include
using namespace std;
void solve()
{
int n;
string s;
cin >> n;
cin >> s;
int x = 0, d = 0;
for (auto i : s)
{
if (d == 4)
{
x = 1;
}
if (i == 'a' i == 'e' i == 'i' i = 'o' i == 'u')
{
d = 0;
}
else
{
d++;
}
}
if (x == 0)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
int main()
{
int t;
cin >> t;
// in(t);
while (t--)
{
solve();
}
return 0;
}
0 Comments