#include #include #include #include int main() { long n,prev=0,j=0,i,ct=0; char c; scanf("%ld",&n); for(i=1;i<=n;i++) { c=getchar(); prev=j; if(c=='U') j++; else if(c=='D') j--; if(prev==0 && j<0) ct++; } printf("%ld",ct); /* Enter your code here. Read input from STDIN. Print output to STDOUT */ return 0; }