#include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int stepCount = 0,downCount = 0,valleyCount = 0; cin>>stepCount; //char *seq = new char(stepCount); string seq; cin>>seq; for(int i = 0;i< stepCount;i++) { if(seq[i] == 'D') downCount--; else if(seq[i] == 'U') downCount++; if(seq[i] == 'U' && downCount == 0) { valleyCount++; downCount = 0; } } cout<