1 solutions

  • -1
    @ 2024-3-18 16:00:25

    #include #include

    using namespace std;

    string s; int k;

    char calc(string s,int k){ int cnt = 1; for (int i=1;i<=s.length()-1;i++){ if (s[i] == s[i-1]) cnt++; else cnt = 1; if (cnt>=k) return (s[i]); } return '^'; }

    int main(){ cin >> k >> s; if (calc(s,k)!='^') cout << calc(s,k); else cout << "No";

    }

    • 1

    Information

    ID
    6941
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    # Submissions
    39
    Accepted
    32
    Uploaded By