import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); in.nextLine(); String seq = in.nextLine(); char[] steps= seq.toCharArray(); int stepsInt[] = new int[n]; for(int i=0; i < n; i++){ stepsInt[i] = (steps[i] == 'U') ? 1 : -1; } for(int i=1; i < n; i++){ stepsInt[i] += stepsInt[i-1]; } char[] shifts = new char[n]; shifts[0] = (stepsInt[0] == 1) ? 'U' : 'D'; int k = 1; for(int i=1; i < n; i++){ if(stepsInt[i-1] == 0 && stepsInt[i] == -1){ shifts[k++] = 'D'; }else if(stepsInt[i-1] == -1 && stepsInt[i] == 0) shifts[k++] = 'U'; } int count = 0; for(int i = 1; i