fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. string input;
  7.  
  8. void check(string::iterator& it)
  9. {
  10. switch(*it)
  11. {
  12. case '=' :
  13. {
  14. it += 2;
  15. if(it != input.end())
  16. if(*it == 'd')
  17. it++;
  18. break;
  19. }
  20. case '-' :
  21. {
  22. it += 2;
  23. break;
  24. }
  25. case 'j' :
  26. {
  27. it++;
  28. if(it != input.end())
  29. if ((*it == 'l') || (*it == 'n'))
  30. it++;
  31. break;
  32. }
  33. default :
  34. {
  35. it++;
  36. break;
  37. }
  38. }
  39. return;
  40. }
  41.  
  42. int main()
  43. {
  44. cin >> input;
  45. reverse(input.begin(), input.end());
  46.  
  47. int charCount = 0;
  48.  
  49. auto it = input.begin();
  50. while(it != input.end())
  51. {
  52. check(it);
  53. ++charCount;
  54. }
  55.  
  56. cout << charCount;
  57.  
  58. }
Success #stdin #stdout 0.01s 5512KB
stdin
ds=
stdout
1