Hi,
Problem ==> http://mirror.codeforces.com/problemset/problem/1084/C
My solution gets WA in test case 10 and I think it because overflow but I can't see any overflow problem.
include<bits/stdc++.h>
using namespace std;
const int INF = 1e9+7;
define mp make_pair
define pb push_back
int MOD(int x){ return ((x%INF)+INF)%INF; }
int main()
{
string n;cin >> n;
string s;
for(int i=0;i<n.size();++i){
if(n[i]=='a' || n[i]=='b') s+=n[i];
}
//Get number of all of the contigiuos 'a's
vector<int> ans;
int cnt = 0;
for(int i=0;i<s.size();++i){
if(s[i]=='a') ++cnt;
else{
ans.pb(cnt);cnt=0;
}
}ans.push_back(cnt);
//Calculate the answer
long long res=1;
for(auto &i : ans){
res = MOD(MOD(res) * MOD(i+1));
}cout << res-1;
}