top1编程
← 返回题目
题解

【基础】小X数字母

1 条题解

  • 0
    @ 2026-7-29 0:15:33
    #include <iostream>
    #include <string>
    using namespace std;
    
    int main() {
        int N;
        string s;
        cin >> N >> s;
        
        int max_count = 0;
        int current_count = 0;
        
        for (char c : s) {
            if (c == 'A') {
                current_count++;
                if (current_count > max_count) {
                    max_count = current_count;
                }
            } else {
                current_count = 0;
            }
        }
        
        cout << max_count << endl;
        return 0;
    }
    
    • 1