#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<iomanip>
using namespace std;
string s;
long long int Mod = 1000000000 + 7;
long long int power(long long int a, long long int b){
long long int res = 1;
long long int k = a;
for (; b; b >>= 1, k = (k*k) % Mod){
if (b & 1) res = (res*k) % Mod;
}
return res;
}
int main(){
while (cin >> s){
long long int numa = 0;
long long int total = 0;
for (int i = 0; i < s.size(); i++){
if (s[i] == 'a') numa++;
else{
long long int t = 2;
total = (total + power(t, numa) - 1) % Mod;
}
}
cout << total << endl;
}
return 0;
}
B - Minimum number of steps
最新推荐文章于 2020-04-02 12:10:00 发布