Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- char s[1000005];
- int k = 0,n;
- while(scanf("%s %d",s,&n)==2)
- {
- k++;
- printf("Case %d:\n",k);
- int a,b,i,j;
- for(i=0;i<n;i++)
- {
- cin>>a>>b;
- if(a>b)
- {
- a = a+b;
- b = a-b;
- a = a-b;
- }
- bool fg = false;
- for(j=a;j<b;j++)
- {
- if(s[j]!=s[j+1])
- {
- fg = true;
- break;
- }
- }
- if(fg == false) cout<<"Yes"<<endl;
- else cout<<"No"<<endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement