/* -*- coding: utf-8 -*- * * 2894.cc: No.2894 Monotonic Intervals - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 500000; /* typedef */ /* global variables */ char s[MAX_N + 4]; /* subroutines */ /* main */ int main() { int n; scanf("%d%s", &n, s); int cnt = 0; for (int i = 0; i < n;) { int j = i; while (i < n && s[j] == s[i]) i++; cnt++; } printf("%d\n", cnt); return 0; }