#include<iostream> #include<string> usingnamespacestd ; int P , PA , PAT; intmain(){ string s ; cin >> s ; for(int i = 0 ; i < s.length() ; i++) { if(s[i] == 'P') { P ++ ; P %= 1000000007; } if(s[i] == 'A') { PA += P ; PA %=1000000007 ; } elseif(s[i]== 'T') { PAT += PA; PAT %= 1000000007 ; } } cout << PAT << endl ;