Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///http://codeforces.com/problemset/problem/698/A
- ///https://trello.com/c/d7uV2sBM/32-problem-894a-codeforces
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- string s;
- cin>>s;
- int Q=0, QA=0, QAQ = 0;
- for(int i=0; i<s.size(); i++)
- {
- if (s[i]=='Q')
- QAQ+=QA, Q++;
- if (s[i]=='A')
- QA+=Q;
- }
- cout<<QAQ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment