#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int t, i, a, b, j, k = 1;
while(cin >> s)
{
cin >> t;
cout << "Case " << k++ << ":" << endl;
int maxi, mini;
for(i=1;i<=t;i++)
{
cin >> a >> b;
if(a==b)
cout << "Yes" << endl;
else
{
maxi = max(a, b);
mini = min(a, b);
char ch = s[mini];
int c = 0, f = 0;
for(j=mini;j<=maxi;j++)
{
if(s[j] == ch)
c++;
else
{
cout << "No" << endl;
f = 1;
break;
}
}
if(f == 0)
cout << "Yes" << endl;
}
}
}
return 0;
}
using namespace std;
int main()
{
string s;
int t, i, a, b, j, k = 1;
while(cin >> s)
{
cin >> t;
cout << "Case " << k++ << ":" << endl;
int maxi, mini;
for(i=1;i<=t;i++)
{
cin >> a >> b;
if(a==b)
cout << "Yes" << endl;
else
{
maxi = max(a, b);
mini = min(a, b);
char ch = s[mini];
int c = 0, f = 0;
for(j=mini;j<=maxi;j++)
{
if(s[j] == ch)
c++;
else
{
cout << "No" << endl;
f = 1;
break;
}
}
if(f == 0)
cout << "Yes" << endl;
}
}
}
return 0;
}
Comments
Post a Comment