#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #define MAX 100000 int main() { long int n; char car; scanf("%ld",&n); long int i; long int indice=0; long int downhills=0; scanf("%c",&car); for(i=0;i<n;i++){ scanf("%c",&car); //printf("%c****\n",car); if(car=='U'){ //printf("\n*%d*\n",indice); indice++; //printf("*%d*\n",indice); if(indice==0) downhills++; } else{ //printf("blem\n"); indice--; } } printf("%ld",downhills); }