Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char s[1000009];
- scanf("%s", s);
- int i, j, c = 0, k = 0;
- for(i = strlen(s) - 1; i >= 0; i--)
- {
- if(s[i]=='b') c++;
- else
- {
- k += c;
- c *= 2;
- k %= 1000000007;
- c %= 1000000007;
- }
- }
- printf("%d\n", k);
- }
Advertisement
Add Comment
Please, Sign In to add comment