#include #include #include #include #include using namespace std; int main() { int n; int x; int move = 0; int v = 0; char u('U'); cin >> n; char c[n]; for (x = 0; x < n; x++) { cin >> c[x]; if (move == -1 && c[x] == u) { v++; } if (c[x] == u) { move++; } else { move--; } } cout << v; return 0; }