@@ -0,0 +1,585 @@
+private static final String DOWN = %22D%22;%0Aprivate static final String UP = %22U%22;%0A%0A// Complete the countingValleys function below.%0Astatic int countingValleys(int n, String s) throws IOException %7B%0A    int valleysCount = 0;%0A    int currentDepth = 0;%0A%0A    for (int x = 0; x %3C n; x++) %7B%0A        String nextStep = String.valueOf(s.charAt(x));%0A%0A        if (currentDepth == -1 && nextStep.equals(UP)) %7B%0A            valleysCount++;%0A        %7D%0A%0A        if (nextStep.equals(DOWN)) %7B%0A            currentDepth--;%0A        %7D else %7B%0A            currentDepth++;%0A        %7D%0A    %7D%0A%0A    return valleysCount;%0A%7D%0A

add counting valleys