Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int MOD = int(1e9) + 7;
- long long cnt, ans;
- int main(){
- cin >> s;
- for(int i = s.size() - 1; i >= 0; i--){
- if(s[i] == 'b')
- cnt++;
- cnt %= MOD;
- else
- ans += cnt;
- ans %= MOD;
- cnt *= 2;
- cnt %= MOD;
- }
- cout << ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement