Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<algorithm>
- #include<string>
- #include<set>
- #include<iterator>
- #include<map>
- #include<deque>
- #include<math.h>
- #include<numeric>
- #include<queue>
- #include<stack>
- #define int long long
- #define pb push_back
- #define MOD 998244353
- using namespace std;
- signed main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- string s;
- cin >> s;
- int cnt = 0, n = s.size(), ans = 0, full = 0;
- reverse(s.begin(), s.end());
- for (int i = 0; i < n - 1; i++) {
- if (s[i] == s[i + 1] && s[i] == 'v') {
- full++;
- }
- if (s[i] == 'o') {
- cnt += full;
- }
- }
- reverse(s.begin(), s.end());
- bool x = 0;
- for (int i = 0; i < n - 1; i++) {
- if (s[i] == s[i + 1] && s[i] == 'v') {
- full--;
- ans += cnt;
- }
- if (s[i] == 'o') {
- cnt -= full;
- }
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement