Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- #include<math.h>
- int main() {
- char str[1000010];
- int j=1;
- while(scanf("%s", &str)!=EOF) {
- if(strcmp(str,"\n")==0 || str[0]=='\0') break;
- int n, a, b, i;
- scanf("%d", &n);
- printf("Case %d:\n", j++);
- while(n--) {
- scanf("%d %d", &a, &b);
- if(b<a) {
- a+=b;
- b=a-b;
- a-=b;
- }
- char ch=str[a];
- int c=0;
- for(i=a; i<=b; i++) {
- if(str[i]!=ch) {
- c++;
- break;
- }
- }
- if(c==0) printf("Yes\n");
- else printf("No\n");
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment