-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUva10324.cpp
More file actions
52 lines (47 loc) · 1001 Bytes
/
Copy pathUva10324.cpp
File metadata and controls
52 lines (47 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <sstream>
using namespace std;
typedef pair<string,int> si;
int main()
{
char s[1000015];
int cas=0;
while(scanf("%s",s)!=EOF){
int n;
scanf("%d",&n);
cout<<"Case "<<cas<<":"<<endl;
while(n--){
int p1,p2;
scanf("%d %d",&p1,&p2);
if(p1>p2){
int temp=p2;
p2=p1;
p1=temp;
}
if(p1==p2)cout<<"Yes"<<endl;
bool flag=true;
for(int i=p1;i<p2;i++){
if(s[i]!=s[i+1]){
flag=false;
break;
}
}
if(flag){
cout<<"Yes"<<endl;
}
else{
cout<<"No"<<endl;
}
}
}
return 0;
}