import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
StringBuilder sb = new StringBuilder("");
String m = "";
int cases = 1;
while ((m = br.readLine()) != null) {
sb.append("Case ").append(cases).append(":\n");
int n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i++) {
String[] str = br.readLine().split(" ");
int x = Integer.parseInt(str[0]);
int y = Integer.parseInt(str[1]);
Boolean flag = false;
for (int j = Math.min(x, y); j < Math.max(x, y); j++) {
if (m.charAt(j) != m.charAt(j + 1)) {
flag = true;
break;
}
}
if (flag) {
sb.append("No\n");
} else {
sb.append("Yes\n");
}
}
cases++;
}
System.out.print(sb);
}
}
No comments:
Post a Comment