➤ Problem Link : 1324C. Frog Jumps
✅ C++ Solution :
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
int mx=0;
int prev=-1;
int n=s.length();
for(int i=0;i<n;i++)
{
if(s[i]=='L')
continue;
else
{
mx=max(mx,i-prev);
prev=i;
}
}
mx=max(mx,n-prev);
cout<<mx<<endl;
}
}
Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.
😇Happy Learning!!
