int solve(string answerKey, int k,char ch)
{
int i=0,j=0,ans=0,t=0;
while(j<answerKey.size())
{
if(answerKey[j]==ch)
t++;
while(i<=j && t>k)
{
if(answerKey[i]==ch)
t--;
i++;
}
ans=max(ans,j-i+1);
j++;
}
//cout<<"i: "<<i<<" j: "<<j<<" Tans: "<<ans<<endl;
return ans;
}
int maxConsecutiveAnswers(string answerKey, int k)
{
return max(solve(answerKey,k,'F'),solve(answerKey,k,'T'));
}