alvy10

Untitled

Jul 7th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string s;
  8. cin >> s;
  9.  
  10. int minAbility = 1, temp=1;
  11.  
  12. if(s.size() == 1){
  13. if(s[0] != 'A' && s[0] != 'E' && s[0] != 'I' && s[0] != 'O' && s[0] != 'U' && s[0] != 'Y'){
  14. //cout<<2<<endl;
  15. minAbility = 2;
  16. }
  17. else{
  18. //cout<<1<<endl;
  19. minAbility = 1;
  20. }
  21.  
  22. cout << minAbility << endl;
  23.  
  24. return 0;
  25. }
  26.  
  27. for(int i = 0; i < s.size(); i++){
  28. //temp = 0;
  29. // if(i==0){
  30. int j = i;
  31. while(s[j] != 'A' && s[j] != 'E' && s[j] != 'I' && s[j] != 'O' && s[j] != 'U' && s[j] != 'Y'){
  32. temp++;
  33. if(j >= s.size())
  34. break;
  35. j++;
  36. }
  37. //cout << temp<<endl;
  38. i = j;
  39. if(temp>minAbility)
  40. minAbility = temp;
  41. temp = 1;
  42. //continue;
  43. //}
  44. //cout<<i<<endl;
  45. }
  46. //cout<<i;
  47. cout << minAbility << endl;
  48.  
  49. return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment