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