Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4. #include<string>
  5. #include<set>
  6. #include<iterator>
  7. #include<map>
  8. #include<deque>
  9. #include<math.h>
  10. #include<numeric>
  11. #include<queue>
  12. #include<stack>
  13.  
  14. #define int long long
  15. #define pb push_back
  16. #define MOD 998244353
  17. using namespace std;
  18.  
  19. signed main()
  20. {
  21. ios_base::sync_with_stdio(0);
  22. cin.tie(0);
  23. cout.tie(0);
  24. string s;
  25. cin >> s;
  26. int cnt = 0, n = s.size(), ans = 0, full = 0;
  27. reverse(s.begin(), s.end());
  28. for (int i = 0; i < n - 1; i++) {
  29. if (s[i] == s[i + 1] && s[i] == 'v') {
  30. full++;
  31. }
  32. if (s[i] == 'o') {
  33. cnt += full;
  34. }
  35. }
  36. reverse(s.begin(), s.end());
  37. bool x = 0;
  38. for (int i = 0; i < n - 1; i++) {
  39. if (s[i] == s[i + 1] && s[i] == 'v') {
  40. full--;
  41. ans += cnt;
  42. }
  43. if (s[i] == 'o') {
  44. cnt -= full;
  45. }
  46. }
  47. cout << ans;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement