#include #include #include #include #include using namespace std; int findValleys(vector s){ int h=0,d=0,nValley=0; for(int i=0;i0){ if(d==1){ nValley++; } d--; } if (s[i] == 'D' && h>0){ h--; } } //cout << nValley; return nValley; } int main() { int n; cin >> n; cin.ignore (std::numeric_limits::max(), '\n'); vector steps; char step; for(int i=0; i> step; steps.push_back(step); } cout << findValleys(steps); return 0; }