class Solution {
public:
bool judgeCircle(string moves) {
int UCnt = 0, DCnt = 0, LCnt = 0, RCnt = 0;
for (int i = 0; i < moves.length(); ++i) {
switch (moves[i]) {
case'U':++UCnt; break;
case'D': ++DCnt; break;
case'L': ++LCnt; break;
case'R': ++RCnt; break;
}
}
if (UCnt == DCnt&&LCnt == RCnt)return true;
else return false;
}
};