1767: [NewOJ Contest 8] QAQ

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:59 通过:28

题目描述

给你一个长度为2000的字符串S,只包含字符A和Q,请求出存在多少个长度为3的子序列是QAQ。
即存在多少种情况满足S[i]='Q',S[j]='A',S[k]='Q',i<j<k。

输入格式

无输入,给定字符串在样例输入中。

输出格式

输出一个数字表示答案。

输入样例 复制

QQAAQAQQAQQQAQAQAQQQQQQQAAQQQQQQQQQAQAAQQQQQQQQAQAQQAQQAQQAAAQQQQAAQAAQQQQAQQQQQQQQAQQAQQAQQQAQAQQQQQQAQQQQQQQQQQAQQQQQQAQQQQQQAQAQAQAAAQQAQAQQQQQAQQQQAQAQQQQQQAQQQQQAQQQAQQAQQQQQAAQQAQQQQAQQAQAQQQQAAQQQQQQAQAQQAQQAQQAQQAQAQQQQQQQQQQQAAQQAAQQAQQQQAAQQQQQQQAQQQAQQQQQQQAQQQAQQQQQQAQQQQQAAAQAAAQQAQQQQQQQAQQAQAAQAQAQQQAAAAAAQAAQQAQAQAQQQAQAQQQAQAQQQQQQAAQAAAQQAAQQAQQQQQQQQQQQAQAQQQAQQQQAQAQQQQQQAQQAQQAQQAQQQQQAQAQQAAAQQQAQQQQQQAQQQAQQQQQAAQAQQQAAQQAQQAQAQAAQAQAQAQQAAQAQAQAQQQAQQQAAQAQQQAAQAQQAQQQAAQAAAAQAAQQQQAQQQAQAQQQAAAAQQQQAQAAQQQQAAQQQQQAQAQAAQAAAQQQQQAQQAQQQAQQQQQQQAQAAQQQQQAQAAQQQQQQAQQAQQQQAAQQQQQQQAAQAAQAQQQQAQAQQQQAQAQQQQAQQQQQAQAQQQAQAQQQQQAQAQQAAQQQAQQQQQQAAQAQAQQQQAAQQQAQQQQAAQAQQAQQAAAAQQAQQQQQAQQAAQQQQQQAQQAQQAQQAQQQAAQQQQQQQQAQQQQQQAQAQAQQAQAAQQQQQQQQQAQQQQAQQQAAQQQQQQQAQQQAQAAQQQQQ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