BG

mail@pastecode.io avatar
unknown
c_cpp
3 years ago
381 B
15
Indexable
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t;
    cin >> t;
    for(int i = ***; i <= t; i++)
    {
        string s;
        cin >> s;
        s='@'+***;
        int cntU=0,cntD=0;
        for(int j=1;j<***.size();j++){
            if(s[j]=='U' && ***)cntU++;
            if(*** && s[j-1]!='D')cntD++;
        }

        cout<<min(***,***)<<endl;
    }
}