Submission #236060

#TimeUsernameProblemLanguageResultExecution timeMemory
236060VEGAnnAron (COCI17_aron)C++14
50 / 50
5 ms384 KiB
#include <bits/stdc++.h>
using namespace std;
int n, ans = 0;
char c[100];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> c[i];

    for (int i = 0; i < n; ){
        int j = i;

        while (j < n && c[j] == c[i])
            j++;

        ans++;
        i = j;
    }

    cout << ans + 1 << '\n';

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...