#include #include #include #include #include using namespace std; int main() { int N; cin >> N; string path; cin >> path; int a = 0; int downhill = 0; for (int i= 0; i < N; i++) {if (path[i] == 'U'){a = a + 1;} if (path [i] == 'D'){a = a - 1;} if ((path[i] == 'U') && (a == 0)){downhill = downhill +1;} } cout << downhill; /* Enter your code here. Read input from STDIN. Print output to STDOUT */ return 0; }