using System; using System.Collections; using System.IO; class Solution { static void Main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ int n = Convert.ToInt32(Console.ReadLine()); char[] steps = Console.ReadLine().ToCharArray(); if (n <= 0) return; int prevStep = 0; int valleyCount = 0; foreach(char step in steps) { if (step == 'D') { prevStep = prevStep - 1; } else { prevStep = prevStep + 1; if (prevStep == 0) valleyCount++; } } Console.Write(valleyCount); } }