链接:LeetCode657
过程:略
思路:略
代码:
class Solution {
public boolean judgeCircle(String moves) {
int a=0,b=0,c=0,d=0;
for(int i=0;i<moves.length();i++){
switch(moves.charAt(i)){
case 'L':a++;break;
case 'R':b++;break;
case 'U':c++;break;
case 'D':d++;break;
}
}
return a==b&&c==d;
}
}