AlenAntonelli

QAQ

Jul 9th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. ///http://codeforces.com/problemset/problem/698/A
  2. ///https://trello.com/c/d7uV2sBM/32-problem-894a-codeforces
  3.  
  4. #include <iostream>
  5. #include <vector>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. string s;
  11. cin>>s;
  12.  
  13. int Q=0, QA=0, QAQ = 0;
  14.  
  15. for(int i=0; i<s.size(); i++)
  16. {
  17. if (s[i]=='Q')
  18. QAQ+=QA, Q++;
  19.  
  20. if (s[i]=='A')
  21. QA+=Q;
  22. }
  23. cout<<QAQ;
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment