-
Notifications
You must be signed in to change notification settings - Fork 39
/
Noble Vowel.cpp
60 lines (56 loc) · 991 Bytes
/
Noble Vowel.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <bits/stdc++.h>
using namespace std;
int isvowel(char ch);
{
int check=0,t;
cin>>t;
while(t--){
check=0;
string data;
cin>>data;
int i=0;
while(i!=data.length())// to check the complete string
{
if(check==0)//contion when next can be anything
{
if(isalpha(data[i]))
{
if(isvowel(data[i]))
check=0;
else
{
if(data[i]=='n')
check=0;
else
check=1;
}
}
else
check=-1;
}
else if(check==1)
{
if(isvowel(data[i]))
check=0;
else
check=-1;
}
else if(check==-1)//-1 indicate the string break the rules
break;
i++;
}
if(check==0)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
int isvowel(char ch)
{
ch=tolower(ch);
if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
return 1;
else
return 0;
}