#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
void solve();
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("error.txt","w",stderr);
freopen("output.txt",stdout);
#endif
int t=1;
// /*is Single Test case?*/cin>>t;
while(t--)
{
solve();
cout<<"\n";
}
cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
return 0;
}
void solve()
{
int s[6][200005];
string S,x[6]={"abc","acb","bac","bca","cab","cba"};
int n,m;
cin>>n>>m;
for(int i=0;i<200005;i++)
s[0][i]=0;
// string S;
cin>>S;
cout<<S;
for(int i=0;i<6;i++)
{
for(int j=1;j<=n;j++)
{
s[i][j]=s[i][j-1]+(S[j-1]!=x[i][(j-1)%3]);
}
}
while(m--)
{
int l,r;
cin>>l>>r;
int ans=INT_MAX;
for (int i = 0; i < 6; ++i)
{
ans=min(ans,s[i][r]-s[i][l-1]);
/* code */
}
cout<<ans<<"\n";
// cout<<endl;
}
}
***我为 CPP 以及普通程序和示例程序设置了完美的 sublime 文本,一切正常,但是今天当我在构建程序时解决有关代码力的问题之一时,我的输出没有得到任何结果.txt 文件让我在比赛中受苦,所以任何人都可以帮助我 ***