fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,c=0;
  6. cin>>t;
  7. while(t--)
  8. {
  9. string s;
  10. cin>>s;
  11. int l=s.length();
  12. for(int i=0;i<l;i++)
  13. {
  14. if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u')
  15. {
  16. c++;
  17. if(c==3)
  18. {
  19. cout<<"happy"<<endl;
  20. break;
  21. }
  22. }
  23. else c=0;
  24. }
  25. if(c!=3)
  26. cout<<"sad"<<endl;
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 5320KB
stdin
4
aeiou
abxy
aebcdefghij
abcdeeafg
stdout
happy
sad
sad
happy