fork download
  1.  
  2. #include<iostream>
  3. #include<map>
  4. #include<string.h>
  5. using namespace std;
  6.  
  7. int check(string s)
  8. {
  9. int count=0;
  10. for(int i=0;i<s.length()-3;i++)
  11. {
  12. if(s[i]=='c'||s[i]=='h'||s[i]=='e'||s[i]=='f')
  13. {
  14. map<char,int>m;
  15. m['c']=1;
  16. m['h']=1;
  17. m['e']=1;
  18. m['f']=1;
  19. int pos=i;
  20. for(int j=0;j<4&&s[pos]!='\0';j++)
  21. {
  22. if(s[pos]=='c'||s[pos]=='h'||s[pos]=='e'||s[pos]=='f')
  23. m[s[pos]]--;
  24. else
  25. break;
  26. pos++;
  27. }
  28. if(m['c']==0&&m['h']==0&&m['e']==0&&m['f']==0)
  29. count++;
  30. }
  31. }
  32. return count;
  33. }
  34.  
  35.  
  36. main()
  37. {
  38. int cases;
  39. cin>>cases;
  40. while(cases--)
  41. {
  42. string s;
  43. cin>>s;
  44. int occr=check(s);
  45. if(occr>0)
  46. cout<<"lovely "<<occr<<endl;
  47. else
  48. cout<<"normal"<<endl;
  49. }
  50. }
  51.  
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty