void solve() throws IOException { in("__std"); out("__std"); String s = readLine(); while (!s.equals(";STOP;")) { final StringTokenizer st = new StringTokenizer(s, ";"); println("Rating " + st.nextToken() + ": " + st.nextToken()); for (int i = 0; i < 3; ++i) { final String[] p = st.nextToken().split("/"); println(p[0] + ", " + p[1]); } println("----------"); s = readLine(); } exit(); }
void solve() throws IOException { in = new InputReader("__std"); out = new OutputWriter("__std"); int testCount = in.readInt(); for (int test = 1; test <= testCount; ++test) { char[] l = in.readToken().toCharArray(); char[] s = new char[l.length]; int top = -1; for (int i = 0; i < l.length; ++i) { if (top != -1 && reverse(l[i]) == s[top]) { --top; } else { s[++top] = l[i]; } } out.println(top == -1 ? "Yes" : "No"); } exit(); }