#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
const int N=1e6+5;
const int BASE=13331;
int m;
ull H[N],P[N];
string s;
ull get_hash(int l,int r){
return H[r]-H[l-1]*P[r-l+1];
}
int main(){
cin>>s>>m;
H[0]=s[0],P[0]=1;
for(int i=1;i<s.size();i++) H[i]=H[i-1]*BASE+s[i];
for(int i=1;i<s.size();i++) P[i]=P[i-1]*BASE;
while(m--){
int l1,r1,l2,r2;
cin>>l1>>r1>>l2>>r2;
l1--,r1--,l2--,r2--;
cout<<(get_hash(l1,r1)==get_hash(l2,r2)?"Yes\n":"No\n");
}
return 0;
}剪贴板
剪贴板 f637bden
剪贴板信息
剪贴板信息
- 收录
- 更新