Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define endl "\n"
- using namespace std;
- int main() {
- int c = 0;
- string s1;
- cin >> s1;
- if(s1.size() == 1) {
- cout << 0;
- } else {
- for(int i=0; i<s1.size()-2; i++) {
- if(s1[i] == 'Q') {
- for(int j=i+1; j<s1.size()-1; j++) {
- if(s1[j] == 'A') {
- for(int k = j+1; k<s1.size(); k++) {
- if(s1[k] == 'Q') {
- c++;
- }
- }
- }
- }
- }
- }
- cout << c;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement