Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string s;
- cin >> s;
- int minAbility = 1, temp=1;
- if(s.size() == 1){
- if(s[0] != 'A' && s[0] != 'E' && s[0] != 'I' && s[0] != 'O' && s[0] != 'U' && s[0] != 'Y'){
- //cout<<2<<endl;
- minAbility = 2;
- }
- else{
- //cout<<1<<endl;
- minAbility = 1;
- }
- cout << minAbility << endl;
- return 0;
- }
- for(int i = 0; i < s.size(); i++){
- //temp = 0;
- // if(i==0){
- int j = i;
- while(s[j] != 'A' && s[j] != 'E' && s[j] != 'I' && s[j] != 'O' && s[j] != 'U' && s[j] != 'Y'){
- temp++;
- if(j >= s.size())
- break;
- j++;
- }
- //cout << temp<<endl;
- i = j;
- if(temp>minAbility)
- minAbility = temp;
- temp = 1;
- //continue;
- //}
- //cout<<i<<endl;
- }
- //cout<<i;
- cout << minAbility << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment