Guest User

Untitled

a guest
Apr 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. bool two(string n)
  5. {
  6. bool check=true;
  7. for(int i=0; i<n.size()-1; i++)
  8. {
  9. if(n[i]==n[i+1] && n[i]!='e' && n[i]!='o')
  10. {
  11. check=false;
  12. break;
  13. }
  14. }
  15. return check;
  16. }
  17. bool threes(string n, string arr)
  18. {
  19. bool check=true;
  20. int num=0;
  21. int sum=0;
  22. if(n.size()>=3)
  23. {
  24. for(int i=0; i<n.size(); i++)
  25. {
  26. check=false;
  27. for(int k=0; k<5; k++)
  28. {
  29. if(n[i]==arr[k])
  30. {
  31. check=true;
  32. break;
  33. }
  34. }
  35. if(check)
  36. {
  37. sum=0;
  38. num++;
  39. }
  40. else
  41. {
  42. num=0;
  43. sum++;
  44. }
  45. if(num==3 || sum==3)
  46. {
  47. check=false;
  48. break;
  49. }
  50. else
  51. {
  52. check=true;
  53. }
  54. }
  55. }
  56. return check;
  57. }
  58. int main() {
  59. string n="\0";
  60. string a="aeiou";
  61. while(1)
  62. {
  63. cin>>n;
  64. if(n=="end")
  65. break;
  66. int num=0;
  67. for(int i=0; i<n.size(); i++)
  68. {
  69. if(num>=1)
  70. break;
  71. for(int k=0; k<5; k++)
  72. {
  73. if(n[i]==a[k])
  74. {
  75. num++;
  76. break;
  77. }
  78. }
  79.  
  80. }
  81. if(num!=0 && two(n) && threes(n,a))
  82. cout<<"<"<<n<<"> is acceptable."<<endl;
  83. else
  84. cout<<"<"<<n<<"> is not acceptable."<<endl;
  85. }
  86. }
Add Comment
Please, Sign In to add comment