class Solution {
public boolean judgeCircle(String moves) {
int lcnt=0;
int rcnt=0;
int ucnt=0;
int dcnt=0;
char[] ch=moves.toCharArray();
int len=moves.length();
for(int i=0;i<len;++i){
if(ch[i]=='R'){
rcnt++;
}
else if(ch[i]=='L'){
lcnt++;
}
else if(ch[i]=='U'){
ucnt++;
}
else{
dcnt++;
}
}
if((rcnt==lcnt)&&(ucnt==dcnt)){
return true;
}
else{
return false;
}
}
}