1class Solution {2public boolean judgeCircle(String moves) {3int up = 0;4int rt = 0;5for (int i = 0; i < moves.length(); i++) {6if (moves.charAt(i) == 'U') up++;7if (moves.charAt(i) == 'R') rt++;8if (moves.charAt(i) == 'L') rt--;9if (moves.charAt(i) == 'D') up--;10}11if (up == 0 && rt == 0) return true;12return false;13}14}