#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <map>
#include <set>
using namespace std;

int T, n;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);

    cin >> T;

    while(T--) {
        string str;

        cin >> str;
        int lcnt=0, rcnt=0;
        for(int i=0; i<str.size(); i++) {
            if(str[i] == 'L') lcnt++;
            else rcnt++;
        }
        if(rcnt ==1) {
            int idx = 0;
            for(int i=0; i<str.size(); i++) {
                if(str[i] =='R') {
                    idx = i;
                    break;
                }
            }
            cout << max((int)str.size()-idx, idx+1) << '\n';
            continue;
        }
        if(str.find('R') == string::npos) { //문자열에 R이 없으면
            cout << str.length() + 1 << '\n';
            continue;
        }
        if(str.find('L') == string::npos) { //문자열에 L이 없으면
            cout << 1 << '\n';
            continue;
        }

        int ans = 0; int idx = 0;
        for(int i = str.size()-1; i>=0; i--) {
            if(str[i] == 'R') {
                if(idx == 0) {
                    idx = i;
                    ans = (int) str.size()-i;
                }
                else {
                    ans=max(ans,idx-i);
                    idx = i;
                }
            }
        }
        ans = max(ans, idx + 1);
        cout << ans << '\n';

    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <map>
#include <set>
using namespace std;

int T, n;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);

    cin >> T;

    while(T--) {
        string str;

        cin >> str;
        int lcnt=0, rcnt=0;
        for(int i=0; i<str.size(); i++) {
            if(str[i] == 'L') lcnt++;
            else rcnt++;
        }
        if(rcnt ==1) {
            int idx = 0;
            for(int i=0; i<str.size(); i++) {
                if(str[i] =='R') {
                    idx = i;
                    break;
                }
            }
            cout << max((int)str.size()-idx, idx+1) << '\n';
            continue;
        }
        if(str.find('R') == string::npos) { //문자열에 R이 없으면
            cout << str.length() + 1 << '\n';
            continue;
        }
        if(str.find('L') == string::npos) { //문자열에 L이 없으면
            cout << 1 << '\n';
            continue;
        }

        int ans = 0; int idx = 0;
        for(int i = str.size()-1; i>=0; i--) {
            if(ans == 0 && str[i] == 'R') {
                ans = (int) str.size() - i;
                idx= i;
            }

            if(idx != 0) {
                if(str[i] == 'R') {
                    int tmp = idx - i;
                    ans = max(ans,tmp);
                }
            }

        }
        cout << ans << '\n';

    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <map>
#include <set>
using namespace std;

int T, n;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);

    string str;
    cin >> T;
    while(T--) {
        cin >> str;

        int ans=0, cnt=0;
        for(int i=0; i<str.size(); i++) {
            cnt++;
            if(str[i] == 'R') {
                ans=max(ans,cnt);
                cnt=0;
            }
        }

        cout << max(ans,++cnt) << '\n';
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        bool ok = false, rightOnly = true;
        for(int i = 0; i < a.size(); ++i){
            if(a[i] == 'L')
                rightOnly = false;
        }
        if(rightOnly){
            cout << 1 << '\n';
            continue;
        }
        int cnt = 0, ans = 0;
        for(int j = 0; j < a.size(); ++j){
            if(a[j] == 'L'){
                cnt++;
            }
            else{
                ans = max(ans, cnt + 1);
                cnt = 0;
            }
        }
        ans = max(ans, cnt + 1);
        cout << ans << '\n';
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        int i = a.size() - 1;
        bool ok = false;
        while(i >= 0 && a[i] == 'L'){
            --i;
            ok = true;
        }
        int k = 0;
        while(k < a.size() && a[k] == 'L'){
            ++k;
            ok = true;
        }
        int ans = max((int)a.size() - i, k + 1);
        if(ok){
            cout << ans << '\n';
            continue;
        }
        for(int j = 0; j < a.size() - 1; ++j){
            if(a[j] == 'L' && a[j + 1] == 'L'){
                ans = 2;
                break;
            }
        }
        cout << ans << '\n';
    } // RRRRRRLLLLLRLRLRLRLRRLLLLLRLRRRRR
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        int i = a.size() - 1;
        bool ok = false, rightOnly = true;
        for(int i = 0; i < a.size(); ++i){
            if(a[i] == 'L')
                rightOnly = false;
        }
        if(rightOnly){
            cout << 1 << '\n';
            continue;
        }
        while(i >= 0 && a[i] == 'L'){
            --i;
            ok = true;
        }
        int k = 0;
        while(k < a.size() && a[k] == 'L'){
            ++k;
            ok = true;
        }
        int ans = max((int)a.size() - i, k + 1);
        if(ok){
            cout << ans << '\n';
            continue;
        }
        int cnt = 0;
        for(int j = 0; j < a.size() - 1; ++j){
            if(a[j] == 'L'){
                cnt++;
            }
            else{
                ans = max(ans, cnt);
                cnt = 0;
            }
        } // LLLLLL
        ans = max(ans, cnt);
        cout << ans + 1 << '\n';
    } // RRRRRRLLLLLRLRLRLRLRRLLLLLRLRRRRR
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        bool r = true, l = true;
        for(int i = 0; i < a.size(); ++i){
            if(a[i] != 'L')
                l = false;
            if(a[i] != 'R')
                r = false;
        }
        if(r){
            cout << 1 << '\n';
            continue;
        }
        if(l){
           cout << a.size() + 1 << '\n';
            continue;
        }
        int i = a.size() - 1;
        while(i >= 0 && a[i] == 'L'){
            --i;
        }
        int k = 0;
        while(k < a.size() && a[k] == 'L'){
            ++k;
        }
        cout << max((int)a.size() - i, k + 1) << '\n';
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        int i = a.size() - 1;
        while(i >= 0 && a[i] == 'L'){
            --i;
        }
        int k = 0;
        while(k < a.size() && a[k] == 'L'){
            ++k;
        }
        cout << max((int)a.size() - i, k + 1) << '\n';
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        int i = a.size() - 1;
        bool ok = false, rightOnly = true;
        for(int i = 0; i < a.size(); ++i){
            if(a[i] == 'L')
                rightOnly = false;
        }
        if(rightOnly){
            cout << 1 << '\n';
            continue;
        }
        while(i >= 0 && a[i] == 'L'){
            --i;
            ok = true;
        }
        int k = 0;
        while(k < a.size() && a[k] == 'L'){
            ++k;
            ok = true;
        }
        int ans = max((int)a.size() - i, k + 1);
        if(ok){
            cout << ans << '\n';
            continue;
        }
        int cnt = 0;
        for(int j = 0; j < a.size() - 1; ++j){
            if(a[j] == 'L' && a[j + 1] == 'L'){
                cnt++;
            }
            else{
                ans = max(ans, cnt);
                cnt = 0;
            }
        } // LLLLLL
        ans = max(ans, cnt);
        cout << ans + 2 << '\n';
    } // RRRRRRLLLLLRLRLRLRLRRLLLLLRLRRRRR
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t, n;
    string a;
    cin >> t;
    while(t--){
        cin >> a;
        bool r = true, l = true;
        for(int i = 0; i < a.size(); ++i){
            if(a[i] != 'L')
                l = false;
            if(a[i] != 'R')
                r = false;
        }
        if(r){
            cout << 1 << '\n';
            continue;
        }
        if(l){
           cout << a.size() + 1 << '\n';
            continue;
        }
        int i = a.size() - 1;
        while(i >= 0 && a[i] == 'L'){
            --i;
        }
        cout << a.size() - i << '\n';
    }
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;
		if(s.length()==1)
		{
			if(s[0]=='L')
			{
				cout<<"2"<<endl;
			}
			else
			{
				cout<<"1"<<endl;
			}
		}
		else
		{

		int k=0;
		for(int i=0;i<s.length()-1;i++)
		{
			if(s[i]=='R'&&k==0)
			{
				counts=i+1;
				k=1;
			}

			if(s[i]==s[i+1]&&s[i]=='L')
			{
				if(countl==0)
				{
					countl=2;
				}
				else
				{

				countl++;
			}
			}
			else
			{
				if(max<countl)
				{
					max=countl;
				}
				countl=0;
			}
		}
		if(k==0)
		{
			counts=s.length();
		}
			if(max<countl)
				{
					max=countl;
				}
				if(max>=counts)
				{
				max++;
				cout<<max<<endl;
			}
				else
				{
				//	counts++;
					cout<<counts<<endl;
				}

	}

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;

		int k=0;

		for(int i=0;i<s.length();i++)
		{
				countl=0;

			if(s[i]=='L')
			{

				while(s[i]=='L')
				{
					countl++;
					i++;

					if(max<countl)
				{
					max=countl;
				}

			}
		}

}

		max++;
		cout<<max<<endl;

			}
	}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;
		if(s.length()==1)
		{
			if(s[0]=='L')
			{
				cout<<"2"<<endl;
			}
			else
			{
				cout<<"1"<<endl;
			}
		}
		else
		{

		int k=0;
		for(int i=0;i<s.length()-1;i++)
		{
			if(s[i]=='R'&&k==0)
			{
				counts=i+1;
				k=1;
			}

			if(s[i]==s[i+1]&&s[i]=='L')
			{
				if(countl==0)
				{
					countl=2;
				}
				else
				{

				countl++;
			}
			}
			else
			{
				if(max<countl)
				{
					max=countl;
				}
				countl=0;
			}
		}
			if(max<countl)
				{
					max=countl;
				}
		if(k==0)
		{
			counts=s.length();
		}
		max++;
		cout<<max<<endl;

	}

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;

		int k=0;
		if(s.length()==1)
		{
			if(s[0]=='L')
			{
				cout<<"2"<<endl;
			}
			else
			{
				cout<<"1"<<endl;
			}
		}
		else
		{

		for(int i=0;i<s.length()-1;i++)
		{
			if(s[i]=='R'&&k==0)
			{
				counts=i+1;
				k=1;
			}

			if(s[i]=='L'&&s[i+1]=='L')
			{
				if(countl==0)
				{
					countl=1;
				}

				countl++;
					if(max<countl)
				{
					max=countl;
				}

			}
			else
			{

				countl=0;
			}
		}

		max++;
		cout<<max<<endl;

			}
	}

}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;

		int k=0;
		for(int i=0;i<s.length()-1;i++)
		{
			if(s[i]=='R'&&k==0)
			{
				counts=i+1;
				k=1;
			}

			if(s[i]=='L'&&s[i+1]=='L')
			{
				if(countl==0)
				{
					countl=1;
				}

				countl++;
					if(max<countl)
				{
					max=countl;
				}

			}
			else
			{

				countl=0;
			}
		}

		max++;
		cout<<max<<endl;

	}

}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;

		int k=0;
		if(s.length()==1)
		{
			if(s[0]=='L')
			{
				cout<<"2"<<endl;
			}
			else
			{
				cout<<"1"<<endl;
			}
		}
		else
		{

		for(int i=0;i<s.length()-1;i++)
		{

			if(s[i]=='L')
			{

				countl=0;

				while(s[i]=='L'&&i!=s.length())
				{
					countl++;
				}
					if(max<countl)
				{
					max=countl;
				}

			}

		}

		max++;
		cout<<max<<endl;

			}
	}

}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;
		if(s.length()==1)
		{
			if(s[0]=='L')
			{
				cout<<"2"<<endl;
			}
			else
			{
				cout<<"1"<<endl;
			}
		}
		else
		{

		int k=0;
		for(int i=0;i<s.length()-1;i++)
		{
			if(s[i]=='R'&&k==0)
			{
				counts=i+1;
				k=1;
			}

			if(s[i]==s[i+1]&&s[i]=='L')
			{
				if(countl==0)
				{
					countl=2;
				}
				else
				{

				countl++;
			}
			}
			else
			{
				if(max<countl)
				{
					max=countl;
				}
				countl=0;
			}
		}
			if(max<countl)
				{
					max=countl;
				}
				if(max>countl)
				{
				max++;
				cout<<max<<endl;
			}
				else
				{
					countl++;
					cout<<countl<<endl;
				}

	}

}
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int counts=0,countl=0;
		string s;
		int max=0;
		cin>>s;

		int k=0;
		if(s.length()==1)
		{
			if(s[0]=='L')
			{
				cout<<"2"<<endl;
			}
			else
			{
				cout<<"1"<<endl;
			}
		}
		else
		{

		for(int i=0;i<s.length()-1;i++)
		{

			if(s[i]=='L')
			{

				countl=0;

				while(s[i]=='L'&&i!=s.length())
				{
					countl++;
					i++;
				}
					if(max<countl)
				{
					max=countl;
				}

			}

		}

		max++;
		cout<<max<<endl;

			}
	}

}


#include <iostream>
#include<bits/stdc++.h>
#include<utility>
#include<vector>
#define ll long long
using namespace std;

int main(void) {
	ll t=0,ans=0,i;
	string s;
	cin>>t;
	while(t--){
	    cin>>s;
	    vector<ll>v;
	    v.push_back(0);
	    for(i=0;i<s.length();i++)
	    if(s[i]=='R')
	    v.push_back(i+1);
	    v.push_back(s.length()+1);
	    for(i=0;i<v.size()-1;i++)
	    ans=max(ans,v[i+1]-v[i]);
	    cout<<ans<<"\n";
	    ans=0;
	    v.clear();
	}
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#include<utility>
#include<vector>
#define ll long long
using namespace std;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=0,n,i,j,k,c=0,c1=0;
	string s;
	cin>>t;
	while(t--){
	    cin>>s;
	    for(i=0;i<s.length();i++){
	        if(s[i]=='L'){
	        if (i < s.length()-1 && s[i] == s[i+1])
            c++;
            else
        {
            if (c> c1)
            c1=c;
            c= 1;
        }

	}}
	cout<<c1+1<<"\n";
	c1=0;}
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#include<utility>
#include<vector>
#define ll long long
using namespace std;

int main(void) {
	ll t=0,n,i,j,k,c=0,c1=0;
	string s;
	cin>>t;
	while(t--){
	    cin>>s;
	    for(i=0;i<s.length();i++){
	        if(s[i]=='R')
	        continue;
	        else{
	            c=1;
	        for(j=i+1;j<s.length();j++){
	            if(s[j]=='L')
	            c++;
	            else
	            break;
	        }if(c>=c1)
	        c1=c;
	    }}
	    cout<<c1+1<<"\n";
	    c1=0,c=0;
	}
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#include<utility>
#include<vector>
#define ll long long
using namespace std;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=0,n,i,j,k,c=0,c1=0;
	string s;
	cin>>t;
	while(t--){
	    cin>>s;
	    /*for(i=0;i<s.length();i++){
	        if(s[i]=='R')
	        continue;
	        else{
	            c=1;
	            for(j=i+1;j<s.length();j++){
	                if(s[i]!=s[j])
	                break;
	                c++;
	            }
	            if(c>=c1)
	            c1=c;
	        }
	    }
	    cout<<c1+1<<"\n";
	    c1=0;*/
	    for (int i=0; i<s.length(); i++)
    {
        if(s[i]=='R')
        continue;
        if (i < s.length()-1 && s[i] == s[i+1])
            c++;
        else
        {
            if (c >= c1)
            c1=c;
            c = 1;
        }
    }
    cout<<c1+1<<"\n";
    c1=0;
	}
	return 0;
}


#include <iostream>
#include<bits/stdc++.h>
#include<utility>
#include<vector>
#define ll long long
using namespace std;

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=0,n,i,j,k,c=0,c1=0;
	string s;
	cin>>t;
	while(t--){
	    cin>>s;
	    for(i=0;i<s.length();i++){
	        if(s[i]=='R')
	        continue;
	        else{
	            c=1;
	            for(j=i+1;j<s.length();j++){
	                if(s[i]!=s[j])
	                break;
	                c++;
	            }
	            if(c>=c1)
	            c1=c;
	        }
	    }
	    cout<<c1+1<<"\n";
	    c1=0;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    int t; cin >> t;
    while(t--){
        string str; cin >> str;
        int n = str.size();
        int idx = n - 1;
        int d = n;
        while(idx >= 0){
            if(str[idx] == 'R'){
                break;
            }
            idx--;
        }
        d = n - idx;
        while(idx >= 0){
            int cur_d = d;
            bool found = false;
            for(int i = idx - 1; i >= max(0, idx - d); i--){
                if(str[i] == 'R'){
                    idx = i;
                    found = true;
                    break;
                }
            }
            if(idx <= d - 1){
                break;
            }
            // cout << d << " " << idx << " " << found << endl;

            int count = 0;
            if(!found){
                while(idx > 0){
                    count++;
                    idx--;
                    if(str[idx] == 'R'){
                        break;
                    }
                }
            }

            d += count;
        }
        cout << d << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    int t; cin >> t;
    while(t--){
        string str; cin >> str;
        int n = str.size();
        int idx = n;
        int d = n;
        while(idx >= 0){
            if(str[idx] == 'R'){
                break;
            }
            idx--;
        }

        d = n - idx;
        while(idx >= 0){
            int cur_d = d;
            bool found = false;
            for(int i = idx - 1; i >= max(0, idx - 1 - d); i--){
                if(str[i] == 'R'){
                    idx = i;
                    found = true;
                    break;
                }
            }
            if(idx <= d - 1){
                break;
            }
            // cout << idx << " " << found << endl;

            int count = 0;
            if(!found){
                while(idx > 0){
                    count++;
                    idx--;
                    if(str[idx] == 'R'){
                        break;
                    }
                }
            }

            d += count;
        }
        cout << d << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    int t; cin >> t;
    while(t--){
        string str; cin >> str;
        int n = str.size();
        int idx = n - 1;
        int d = n;
        while(idx >= 0){
            if(str[idx] == 'R'){
                break;
            }
            idx--;
        }
        d = n - idx;
        while(idx >= 0){
            int cur_d = d;
            bool found = false;
            for(int i = idx - 1; i >= max(0, idx - d); i--){
                if(str[i] == 'R'){
                    idx = i;
                    found = true;
                    break;
                }
            }
            if(idx <= d - 1){
                break;
            }
            // cout << d << " " << idx << " " << found << endl;

            int count = 0;
            if(!found){
                while(idx > 0){
                    count++;
                    if(str[idx] == 'R'){
                        break;
                    }
                    idx--;
                }
            }

            d += count - 1;
        }
        cout << d << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
typedef long long   ll;
typedef long double ld;
typedef pair<ll, ll> pll;

ll n;
vector<ll> m;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
    	string s;
    	cin >> s;
    	vector<int> bad;
    	bad.resize(s.size() + 1, 0);
    	for (int j = 0; j < s.size(); j++)
    		if (s[j] == 'L')
    			bad[j + 1] = bad[j] + 1;
    	int ans = 0;
    	for (int j = 0; j < bad.size(); j++)
    		ans = max(ans, bad[j] + 1);
    	cout << ans << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve(){
    int t; cin >> t;
    while(t--){
        string str; cin >> str;
        int n = str.size();
        int idx = n;
        int d = n;
        while(idx >= 0){
            if(str[idx] == 'R'){
                break;
            }
            idx--;
        }

        d = n - idx;
        while(idx > 0){
            int cur_d = d;
            bool found = false;
            for(int i = idx - 1; i >= max(0, idx - 1 - d); i--){
                if(str[i] == 'R'){
                    idx = i;
                    found = true;
                    break;
                }
            }
            if(idx <= d - 1){
                break;
            }
            // cout << idx << " " << found << endl;

            int count = 0;
            if(!found){
                while(idx > 0){
                    count++;
                    idx--;
                    if(str[idx] == 'R'){
                        break;
                    }
                }
            }

            d += count;
        }
        cout << d << endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        string s;
        cin>>s;
        int n = s.length();
        int ans = n+1;
        int temp1 = n+1;
        int j = n;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='R'){
                ans = n-i;
                j = i;
                break;
            }
        }
        for(int i=0;i<n;i++){
            if(s[i]=='R'){
            temp1 = i+1;
            break;
        }
        }
        if(ans==n+1 && temp1==n+1)
        cout<<n+1<<endl;
        else{
            for(int i=j;i>=0;i--){
                if(s[i]=='R' && (j-i)>=ans){
                    j = i;
                    ans = j-1;
                }
            }
            if(ans<temp1)
            cout<<temp1<<endl;
            else
            cout<<ans<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        string s;
        cin>>s;
        int n = s.length();
        int ans = 1;
        int temp = n+1;
        int temp1 = n+1;
        int j = n;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='R'){
                temp = n-i;
                j = i;
                break;
            }
        }
        for(int i=0;i<n;i++){
            if(s[i]=='R'){
            temp1 = i+1;
            break;
        }
        }
        if(temp==n+1 && temp1==n+1)
        cout<<n+1<<endl;
        else{
            for(int i=j;i>=0;i--){
                if(s[i]=='R' && (j-i)>=ans){
                    j = i;
                    ans = j-1;
                }
            }
            if(ans<temp1)
            cout<<temp1<<endl;
            else
            cout<<ans<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        string s;
        cin>>s;
        int n = s.length();
        int maxlim = n+1;
        int minlim = n+1;
        int start = 0;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='R'){
            minlim = n - i;
            start = i;
            break;
            }
        }
        if(minlim = n+1)
        cout<<minlim<<endl;
        else{
            int lef = minlim;
            int j = start;
            for(int i = j;i>=0;i--){
                if(s[i]=='R'){
                    if((start-i)>lef)
                    lef = start-i;
                    start = i;
                }
            }
            cout<<lef<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        string s;
        cin>>s;
        int n = s.length();
        int ans = n+1;
        int temp1 = n+1;
        int j = n;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='R'){
                ans = n-i;
                j = i;
                break;
            }
        }
        for(int i=0;i<n;i++){
            if(s[i]=='R'){
            temp1 = i+1;
            break;
        }
        }
        if(ans==n+1 && temp1==n+1)
        cout<<n+1<<endl;
        else{
            for(int i=j;i>=0;i--){
                if(s[i]=='R' && (j-i)>=ans){
                    j = i;
                    ans = j-i;
                }
            }
            if(ans<temp1)
            cout<<temp1<<endl;
            else
            cout<<ans<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        string s;
        cin>>s;
        int n = s.length();
        int ans = 1;
        int temp = n+1;
        int temp1 = n+1;
        int j = n;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='R'){
                temp = n-i;
                j = i;
                break;
            }
        }
        for(int i=0;i<n;i++){
            if(s[i]=='R'){
            temp1 = i+1;
            break;
        }
        }
        if(temp==n+1 && temp1==n+1)
        cout<<n+1<<endl;
        else{
            for(int i=j;i>=0;i--){
                if(s[i]=='R' && (j-i)>=ans){
                    j = i;
                    ans = j-1;
                }
            }
            if(ans<temp1)
            cout<<temp1<<endl;
            else if(ans<temp)
            cout<<temp<<endl;
            else
            cout<<ans<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t-->0){
        string s;
        cin>>s;
        int n = s.length();
        int ans = n+1;
        int temp1 = n+1;
        int j = n;
        for(int i=n-1;i>=0;i--){
            if(s[i]=='R'){
                ans = n-i;
                j = i;
                break;
            }
        }
        for(int i=0;i<n;i++){
            if(s[i]=='R'){
            temp1 = i+1;
            break;
        }
        }
        if(ans==n+1 && temp1==n+1)
        cout<<n+1<<endl;
        else{
            for(int i=j;i>=0;i--){
                if(s[i]=='R'){
                    if((j-i)>=ans)
                    ans = j-i;
                    j = i;
                }
            }
            if(ans<temp1)
            cout<<temp1<<endl;
            else
            cout<<ans<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,k,n) for(ll i = k;i<n;i++)
#define mo map<ll,ll>
int main(){
	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    ll n = ll(s.size());
     vector<ll> v;
    fr(i,0,ll(s.size())){
    	if(s[i] == 'R'){
    		v.push_back(i);
    	}
    }
    if(ll(v.size()) == 0){
    	cout<<ll(s.size())+1<<"\n";
    }
    else{
    	  ll ans = LLONG_MIN;
   fr(i,0,ll(v.size()-1)){
   	ans = max(ans,v[i]-v[i-1]);
   }
   if(ll(v.size()) != 0){
   	   ans = max(ans,v[0]+1);
   }
if(ll(v.size()) != 0){
	ans = max(ans,n - (v[ll(v.size()) -1]));
}
if(ans == LLONG_MIN){
	ans = n+1;
}

   cout<<ans<<"\n";
    }

    }


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,k,n) for(ll i = k;i<n;i++)
#define mo map<ll,ll>
int main(){
	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    ll n = ll(s.size());
     vector<ll> v;
    fr(i,0,ll(s.size())){
    	if(s[i] == 'R'){
    		v.push_back(i);
    	}
    }
    if(ll(v.size()) == 0){
    	cout<<ll(s.size())+1<<"\n";
    }
    else{
    	  ll ans = LLONG_MIN;
   fr(i,0,ll(v.size()-1)){
   	ans = max(ans,v[i]-v[i-1]);
   }
   if(ll(v.size()) != 0){
   	   ans = max(ans,v[0]+1);
   }
if(ll(v.size()) != 0){
	ans = max(ans,n - (v[ll(v.size()) -1]));
}
if(ans == LLONG_MIN){
	ans = n+1;
}

   cout<<ans<<"\n";
    }

    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,k,n) for(ll i = k;i<n;i++)
#define mo map<ll,ll>
int main(){
	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    ll n = ll(s.size());
     vector<ll> v;
    fr(i,0,ll(s.size())){
    	if(s[i] == 'R'){
    		v.push_back(i);
    	}
    }
    if(ll(v.size()) == 0){
    	cout<<ll(s.size())+1<<"\n";
    }
    else{
    	  ll ans = LLONG_MIN;
   fr(i,0,ll(v.size()-1)){
   	ans = max(ans,v[i+1]-v[i]);
   }
   if(ll(v.size()) != 0){
   	   ans = max(ans,v[0]+1);
   }
if(ll(v.size()) != 0){
	ans = max(ans,n - (v[ll(v.size()) -1]));
}
if(ans == LLONG_MIN){
	ans = n+1;
}

   cout<<ans<<"\n";
    }

    }

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fr(i,k,n) for(ll i = k;i<n;i++)
#define mo map<ll,ll>
int main(){
	 ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    cin>>t;
    while(t--){
    string s;
    cin>>s;
    ll n = ll(s.size());
     vector<ll> v;
    fr(i,0,ll(s.size())){
    	if(s[i] == 'R'){
    		v.push_back(i);
    	}
    }
    if(ll(v.size()) == 0){
    	cout<<ll(s.size())+1<<"\n";
    }
    else{
    	  ll ans = LLONG_MIN;
   fr(i,0,ll(v.size()-1)){
   	ans = max(ans,v[i]-v[i-1]);
   }
   if(ll(v.size()) != 0){
   	   ans = max(ans,v[0]+1);
   }
if(ll(v.size()) != 0){
	ans = max(ans,n - (v[ll(v.size()) -1]));
}
if(ans == LLONG_MAX){
	ans = n;
}

   cout<<ans<<"\n";
    }

    }

}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        string s;
        int k=0;
        cin >> s;
        vector <int> m;
        m.push_back(-1);
        for (int i=0; i<s.size(); i++) {
            if (s[i]=='R') {
                m.push_back(i);
                h++;
            }
        }
        mas.push_back(s.size());
        int mx=mas[0];

        if (k==0) cout << s.size()+1 << endl;
        else {
            if (h==s.size()) cout << 1 << endl;
            else {
                for (int i=1; i<m.size(); i++) {
                    if (m[i]-m[i-1]>mx) mx=m[i]-m[i-1];
                }
                cout << mx << endl;
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        string s;
        int k=0;
        cin >> s;
        vector <int> m;
        m.push_back(-1);
        for (int i=0; i<s.size(); i++) {
            if (s[i]=='R') {
                m.push_back(i);
                h++;
            }
        }
        m.push_back(s.size());
        int mx=m[0];

        if (k==0) cout << s.size()+1 << endl;
        else {
            if (k==s.size()) cout << 1 << endl;
            else {
                for (int i=1; i<m.size(); i++) {
                    if (m[i]-m[i-1]>mx) mx=m[i]-m[i-1];
                }
                cout << mx << endl;
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        string s;
        int k=0;
        cin >> s;
        vector <int> m;
        m.push_back(-1);
        for (int i=0; i<s.size(); i++) {
            if (s[i]=='R') {
                m.push_back(i);
                k++;
            }
        }
        m.push_back(s.size());
        int mx=m[0];

        if (k==0) cout << s.size()+1 << endl;
        else {
            if (k==s.size()) cout << 1 << endl;
            else {
                for (int i=1; i<m.size(); i++) {
                    if (m[i]-m[i-1]>mx) mx=m[i]-m[i-1];
                }
                cout << mx << endl;
            }
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
int main () {
    int n;
    cin >> n;
    for (int j=0; j<n; j++) {
        string s;
        int k=0;
        cin >> s;
        vector <int> m;
        m.push_back(-1);
        for (int i=0; i<s.size(); i++) {
            if (s[i]=='R') {
                m.push_back(i);
                h++;
            }
        }
        m.push_back(s.size());
        int mx=mas[0];

        if (k==0) cout << s.size()+1 << endl;
        else {
            if (h==s.size()) cout << 1 << endl;
            else {
                for (int i=1; i<m.size(); i++) {
                    if (m[i]-m[i-1]>mx) mx=m[i]-m[i-1];
                }
                cout << mx << endl;
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		ll n=s.length();
		ll f=0,c1=0,c2=0;
		vector<ll>v;
		v.push_back(0);
		for(ll i=0;i<n;i++)
		{
           if(s[i]=='R')
           	{
           		f=1;
           		v.push_back(i+1);
           	}
		}
		v.push_back(n+1);
		if(f==0)
			cout<<s.length()+1;
		else
		{
			ll maxi=0;
			for(ll i=0;i<v.size()-1;i++)
				maxi=max(maxi,v[i+1]-v[i]);
			cout<<maxi;

		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		ll n=s.length();
		ll f=0,c1=0,c2=0;
		vector<ll>v;
		for(ll i=0;i<n;i++)
		{
           if(s[i]=='R')
           	{
           		f=1;
           		v.push_back(i+1);
           	}
		}
		if(f==0)
			cout<<s.length()+1;
		else
		{
			ll c1=v[0],c2=n-v[v.size()-1]+1,maxi=max(c1,c2);
			for(ll i=1;i<v.size()-1;i++)
				maxi=max(maxi,v[i]-v[i-1]);
			cout<<maxi;

		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		ll n=s.length();
		ll f=0,c1=0,c2=0;
		vector<ll>v;
		for(ll i=0;i<n;i++)
		{
           if(s[i]=='R')
           	{
           		f=1;
           		v.push_back(i+1);
           	}
		}
		if(f==0)
			cout<<s.length()+1;
		else
		{
			ll c1=v[0],c2=n-v[v.size()-1]+1,maxi=max(c1,c2);
			cout<<maxi;

		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		string s;
		cin>>s;
		ll n=s.length();
		ll f=0,c1=0,c2=0;
		vector<ll>v;
		for(ll i=0;i<n;i++)
		{
           if(s[i]=='R')
           	{
           		f=1;
           		v.push_back(i+1);
           	}
		}
		v.push_back(s.size()+1);
		if(f==0)
			cout<<s.length()+1;
		else
		{
			ll maxi=0;
			for(ll i=0;i<v.size()-1;i++)
				maxi=max(maxi,v[i+1]-v[i]);
			cout<<maxi;

		}
		cout<<endl;
	}

}


#include<bits/stdc++.h>
using namespace std;
#define mod (unsigned long long)1000000007
#define ull unsigned long long
using ll = long long;
#define pb push_back
#define mp make_pair

main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int t;
        cin>>t;
        while(t>0)
        {
            string s;
            cin>>s;
            vector<int> v;
            v.pb(0);
            int n = s.length();
            for(int i=0;i<n;i++)
            {
                if(s[i] == "R")
                {
                      v.pb(i+1);
                }
            }

            v.pb(n+1);
            int ans = 0;
            for(int i=0;i<v.size();i++)
            {
                ans=max(ans,v[i+1]-v[i]);
            }

            cout<<ans<<endl;
            t--;

        }

}


#include<bits/stdc++.h>
using namespace std;
#define mod (unsigned long long)1000000007
#define ull unsigned long long
using ll = long long;
#define pb push_back
#define mp make_pair

main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int t;
        cin>>t;
        while(t>0)
        {
            string s;
            cin>>s;
            vector<ll> v;
            v.pb(0);
            ll n = s.length();
            for(ll i=0;i<n;i++)
            {
                if(s[i] == 'R')
                {
                      v.pb(i+1);
                }
            }

            v.pb(n+1);
            ll ans = 0;
            for(int i=0;i<v.size();i++)
            {
                ans=max(ans,v[i+1]-v[i]);
            }

            cout<<ans<<endl;
            t--;

        }

}


#include<bits/stdc++.h>
using namespace std;
#define mod (unsigned long long)1000000007
#define ull unsigned long long
using ll = long long;
#define pb push_back
#define mp make_pair

main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int t;
        cin>>t;
        while(t>0)
        {
            string s;
            cin>>s;
            vector<int> v;
            v.pb(0);
            int n = s.length();
            for(int i=0;i<n;i++)
            {
                if(s[i] == 'R')
                {
                      v.pb(i+1);
                }
            }

            v.pb(n+1);
            int ans = 0;
            for(int i=0;i<v.size();i++)
            {
                ans=max(ans,v[i+1]-v[i]);
            }

            cout<<ans<<endl;
            t--;

        }

}


#include<bits/stdc++.h>
using namespace std;
#define mod (unsigned long long)1000000007
#define ull unsigned long long
using ll = long long;
#define pb push_back
#define mp make_pair

main()
{
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        int t;
        cin>>t;
        while(t>0)
        {
            string s;
            cin>>s;
            vector<int> v;
            v.pb(0);
            int n = s.length();
            for(int i=0;i<n;i++)
            {
                if(s[i] == 'R')
                {
                      v.pb(i+1);
                }
            }

            v.pb(n+1);
            int ans = 0;
            for(int i=0;i<v.size()-1;i++)
            {
                ans=max(ans,v[i+1]-v[i]);
            }

            cout<<ans<<endl;
            t--;

        }

}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cout<<t<<" "<<l<<" "<<r<<" "<<d<<endl;
                cur = 0;

                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    //cout<<cur<<" "<<next<<endl;
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    cout<<cur<<" "<<next<<endl;
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";

                    if (cur+d<pos[next]) next--;
                    cout<<cur<<"1  "<<next<<endl;
                    if (next<0){
                        check = false;
                        break;
                    }
                    cout<<cur<<"2  "<<next<<endl;
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cout<<cur<<"3  "<<next<<endl;
                    cur = pos[next];
                    cout<<cur<<" 4 "<<next<<endl;
                }

                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    int t,maxd,last;
    string s;
    cin>>t;
    while(t--){
            cin>>s;
            s+='R';
            last = 0;
            maxd=0;
            for(int i=1;i<=s.length();i++)
                if(s[i-1]=='R') maxd = max(maxd,i-last),last=i;
            cout<<maxd<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,maxd,last;
    string s;
    cin>>t;
    while(t--){
            cin>>s;
            s+='R';
            last = 0;
            maxd=0;
            for(int i=1;i<=s.length();i++)
                if(s[i-1]=='R') maxd = max(maxd,i-last),last=i;
            cout<<maxd<<endl;
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ll gcd(ll a,ll b){while(b){a=a%b; swap(a,b);}return a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    //ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    //t=1;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            pos.pb(n+1);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                while(1){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (cur+d<pos[next]){
                        next--;
                    }
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                //cout<<endl<<check<<endl;
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cout<<t<<" "<<l<<" "<<r<<" "<<d<<endl;
                cur = 0;
                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    cout<<cur<<" "<<next<<endl;
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cout<<t<<" "<<l<<" "<<r<<" "<<d<<endl;
                cur = 0;

                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    //cout<<cur<<" "<<next<<endl;
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    cout<<cur<<" "<<next<<endl;
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";

                    if (cur+d<pos[next]) next--;
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }

                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    if (cur+d<pos[next]){
                        next--;
                    }
                    if (next<0){
                        check = false;
                        break;
                    }

                    cur = pos[next];
                }
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    //t=1;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                bool stop =true;
                while(stop){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (cur+d<pos[next]){
                        next--;
                    }
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                //cout<<endl<<check<<endl;
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ll gcd(ll a,ll b){while(b){a=a%b; swap(a,b);}return a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    //t=1;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                while(1){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (cur+d<pos[next]){
                        next--;
                    }
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                //cout<<endl<<check<<endl;
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    cout<<cur<<" "<<next<<endl;
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                bool stop =true;
                while(0){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (cur+d<pos[next]){
                        next--;
                    }
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ll gcd(ll a,ll b){while(b){a=a%b; swap(a,b);}return a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    //ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    //t=1;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                while(1){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (cur+d<pos[next]){
                        next--;
                    }
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                //cout<<endl<<check<<endl;
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cout<<t<<" "<<l<<" "<<r<<" "<<d<<endl;
                cur = 0;

                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    //cout<<cur<<" "<<next<<endl;
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    cout<<cur<<" 0 "<<next<<endl;
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";

                    if (cur+d<pos[next]) next--;
                    cout<<cur<<" 1  "<<next<<endl;
                    if (next<0){
                        check = false;
                        break;
                    }
                    cout<<cur<<" 2  "<<next<<endl;
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cout<<cur<<" 3  "<<next<<endl;
                    cout<<pos[next]<<endl;
                    cur = pos[next];
                    for(int i=0;i<pos.size();i++) cout<<i<<" "<<pos[i]<<" ";
                    cout<<endl;
                    cout<<cur<<" 4 "<<next<<endl;
                }

                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int, pair<int,int>>  kpair;

#define fir first
#define sed second
#define mp make_pair
#define pb push_back
#define lwb lower_bound
#define upb upper_bound
#define watch(x) cout << (#x) << " is " << (x) << endl
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) > (b) ? (b) : (a))
#define ms(a, n) memset(a, n, sizeof(a))

ifstream fi("");
ofstream fo("");
const int mod = 1e9+7;
const int maxn = 1e5;
//modulor
//graph

int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t,n;
    string s;
    vector<int> pos;
    cin>>t;
    while(t--){
            s="";
            cin>>s;
            n = s.length();
            for(int i=1;i<=n;i++)
                if(s[i-1]=='R') pos.pb(i);
            if (pos.size()==0){
                cout<<n+1<<endl;
                continue;
            }
            int l = 1,r=n+1;
            int d,next;
            bool check;
            int cur;
            while(l!=r){
                d = (l+r)/2;
                //cout<<"d "<<d<<endl;
                cur = 0;
                while(true){
                    if (cur+d >= n+1 ){
                        check  = true;
                        break;
                    }
                    next = lwb(pos.begin(),pos.end(),cur+d)-pos.begin();
                    //cout<<cur<<" - "<<pos[next]<<"-"<<next<<" ";
                    next-= (cur+d<pos[next]);
                    if (next<0){
                        check = false;
                        break;
                    }
                    if (cur==pos[next]){
                        check = false;
                        break;
                    }
                    cur = pos[next];
                }
                if (check) r=d; else l=d+1;
            }
            cout<<l<<endl;
        pos.clear();
    }
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}

void solve()
{
    string s; cin >> s;
    int n = s.length();
    int mx = 0; int l = -1;
    for(int i = 0; i < n; i++)
    {
        if(s[i] == 'R')
        {
            mx = max(mx, i - l);
            l = i;
        }
    }
    mx = max(mx, n - l);

    cout << mx << endl;
}

int32_t main()
{
	IOS;
	int t; cin >> t;
	while(t--)
	{
	    solve();
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

const int N = 1e5+5;
int n;
string s;
ll cnt = 0;

bool ok(int x)
{
    int i = -1;
    while(i < n)
    {
        if(i + x >= n)
            return 1;
        bool b = 0;
        for(int j = 1; j <= x; j++)
        {
            if(s[i + j] == 'R')
            {
                i += j;
                b = 1;
                break;
            }
        }
        if(!b)
            return 0;
    }
    return 0;
}

void solve()
{
    cin >> s;
    n = s.size();
    int l = 1, r = n + 1;
    while(l < r)
    {
        int mid = (l + r) / 2;
        if(ok(mid))
        {
            r = mid - 1;
        }
        else l = mid + 1;
    }

    cout << l << endl;
}

int32_t main()
{
    IOS;
    ll t;
    cin >> t;
    while(t--)
    {
        solve();
    }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

int n, k, sz;
bool vis[N];
vector<int> adj[N];

void dfs(int u)
{
    if(vis[u]) return;
    sz++;
    vis[u] = 1;
    for(auto &it: adj[u])
        dfs(it);
}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}

void solve()
{
    string s; cin >> s;
    vector<int> pos;
    pos.push_back(0);
    for(int i = 0; i < s.length(); i++)
    {
        if(s[i] == 'R')
            pos.push_back(i + 1);
    }
    pos.push_back(s.length() + 1);
    int ans = 0;
    for(int i = 0; i < (int)pos.size(); i++)
    {
        ans = max(ans, pos[i + 1] - pos[i]);
    }
    cout << ans << endl;

}

int32_t main()
{
	IOS;
	int t; cin >> t;
	while(t--)
	{
	    solve();
	}
	return 0;

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

const int N = 1e5+5;
int n;
string s;
ll cnt = 0;

bool ok(int x)
{
    int i = -1;
    while(i < n)
    {
        if(i + x >= n)
            return 1;
        bool b = 0;
        for(int j = 1; j <= x; j++)
        {
            if(s[i + j] == 'R')
            {
                i += j;
                b = 1;
                break;
            }
        }
        if(!b)
            return 0;
    }
    return 0;
}

void solve()
{
    cin >> s;
    n = s.size();
    int l = 1, r = n + 1;
    while(l < r)
    {
        int mid = (l + r) / 2;
        if(ok(mid))
        {
            r = mid;
        }
        else l = mid + 1;
    }

    cout << l << endl;
}

int32_t main()
{
    IOS;
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

int n, k, sz;
bool vis[N];
vector<int> adj[N];

void dfs(int u)
{
    if(vis[u]) return;
    sz++;
    vis[u] = 1;
    for(auto &it: adj[u])
        dfs(it);
}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a % b);
}

void solve()
{
    string s; cin >> s;
    vector<int> pos;
    pos.push_back(0);
    for(int i = 0; i < s.length(); i++)
    {
        if(s[i] == 'R')
            pos.push_back(i + 1);
    }
    pos.push_back(s.length() + 1);
    int ans = 0;
    for(int i = 0; i < (int)pos.size() - 1; i++)
    {
        ans = max(ans, pos[i + 1] - pos[i]);
    }
    cout << ans << endl;

}

int32_t main()
{
	IOS;
	int t; cin >> t;
	while(t--)
	{
	    solve();
	}
	return 0;

}


#include <iostream>
#include <cstring>
using namespace std;
#define endl '\n'
#define _fast_ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool canVisitLast(int mid, int last, string s)
{
	int vis[last];
	memset(vis,0,sizeof(vis));
	vis[0] = 1;
	int step = mid;
	while(step<last)
	{
		if(vis[step]==1) return false;
		if(s[step]=='R')
		{
			vis[step] = 1;
			step += mid;
			if(step>=last) return true;
		}
		else if(s[step]=='L')
		{
			vis[step] = 1;
			step -= 1;
			if(vis[step]) return false;
		}

	}
	return true;
}

int solve(string ss)
{
	bool flag = 0;
	for(int i=0; i<ss.length(); i++)
	{
		if(ss[i]!='R')
		{
			flag = 1;
			break;
		}
	}
	if(!flag) return 1;
	int n = ss.length();
	string news = "";
	news += 'x';
	for(auto i : ss) news += i;
	news += 'z';
	int s = 0, e = n+1;
	int ans = 0;
	while(s<=e)
	{
		int mid = (s+e)/2;
		if(canVisitLast(mid,n+1,news))
		{
			ans = mid;
			e = mid-1;
		}
		else
		{
			s = mid+1;
		}
	}
	return ans;

}

int main()
{
	_fast_;
	int t; cin >> t;
	while(t--)
	{
		string s; cin >> s;
		cout << solve(s) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
#define endl '\n'
#define _fast_ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool canVisitLast(int mid, int last, string s)
{
	int *vis = new int[last];
	vis[0] = 1;
	int step = mid;
	while(step<last)
	{
		if(s[step]=='R')
		{
			vis[step] = 1;
			step += mid;
		}
		else if(s[step]=='L')
		{
			vis[step] = 1;
			step -= 1;
			if(vis[step]) return false;
		}
	}
	return true;
}

int solve(string ss)
{
	bool flag = 0;
	for(int i=0; i<ss.length(); i++)
	{
		if(ss[i]!='R')
		{
			flag = 1;
			break;
		}
	}
	if(!flag) return 1;
	int n = ss.length();
	string news = "";
	news += 'x';
	for(auto i : ss) news += i;
	news += 'z';
	int s = 0, e = n+1;
	int ans = 0;
	while(s<=e)
	{
		int mid = (s+e)/2;
		if(canVisitLast(mid,n+1,news))
		{
			ans = mid;
			e = mid-1;
		}
		else
		{
			ans = mid;
			s = mid+1;
		}
	}
	return ans;

}

int main()
{
	_fast_;
	int t; cin >> t;
	while(t--)
	{
		string s; cin >> s;
		cout << solve(s) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
#define endl '\n'
#define _fast_ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool canVisitLast(int mid, int last, string s)
{
	int *vis = new int[last];
	vis[0] = 1;
	int step = mid;
	while(step<last)
	{
		if(vis[step]) return false;
		if(s[step]=='R')
		{
			vis[step] = 1;
			step += mid;
			if(step>=last) return true;
		}
		else if(s[step]=='L')
		{
			vis[step] = 1;
			step -= 1;
			if(vis[step]) return false;
		}

	}
	return true;
}

int solve(string ss)
{
	bool flag = 0;
	for(int i=0; i<ss.length(); i++)
	{
		if(ss[i]!='R')
		{
			flag = 1;
			break;
		}
	}
	if(!flag) return 1;
	int n = ss.length();
	string news = "";
	news += 'x';
	for(auto i : ss) news += i;
	news += 'z';
	int s = 0, e = n+1;
	int ans = 0;
	while(s<=e)
	{
		int mid = (s+e)/2;
		if(canVisitLast(mid,n+1,news))
		{
			ans = mid;
			e = mid-1;
		}
		else
		{
			ans = mid;
			s = mid+1;
		}
	}
	return ans;

}

int main()
{
	_fast_;
	int t; cin >> t;
	while(t--)
	{
		string s; cin >> s;
		cout << solve(s) << endl;
	}
	return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
#define endl '\n'
#define _fast_ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool canVisitLast(int mid, int last, string s)
{
	int *vis = new int[last];
	vis[0] = 1;
	int step = mid;
	while(step<last)
	{
		if(s[step]=='R')
		{
			vis[step] = 1;
			step += mid;
		}
		else if(s[step]=='L')
		{
			vis[step] = 1;
			step -= 1;
			if(vis[step]) return false;
		}
		if(vis[step]) return false;
	}
	return true;
}

int solve(string ss)
{
	bool flag = 0;
	for(int i=0; i<ss.length(); i++)
	{
		if(ss[i]!='R')
		{
			flag = 1;
			break;
		}
	}
	if(!flag) return 1;
	int n = ss.length();
	string news = "";
	news += 'x';
	for(auto i : ss) news += i;
	news += 'z';
	int s = 0, e = n+1;
	int ans = 0;
	while(s<=e)
	{
		int mid = (s+e)/2;
		if(canVisitLast(mid,n+1,news))
		{
			ans = mid;
			e = mid-1;
		}
		else
		{
			ans = mid;
			s = mid+1;
		}
	}
	return ans;

}

int main()
{
	_fast_;
	int t; cin >> t;
	while(t--)
	{
		string s; cin >> s;
		cout << solve(s) << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;
#define _fast_ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define mod 1e9
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define gcd(a,b) __gcd(a,b)
#define count_ones(x) __builtin_popcount(x)
#define _for(k,s,e,inc) for(auto k=s; k<e; k+=inc)
#define _forr(k,s,e,dec) cor(auto k=s, k>=e; k-=dec)

int main()
{
    _fast_;
    int t; cin>>t;
    while(t--)
    {
        string s; cin >> s;
        int n = s.length();
        vector<int> arr;
        arr.pb(0);
        for(int i=0; i<n; i++)
        {
            if(s[i]=='R') arr.pb(i+1);
        }
        arr.pb(n+1);
        int ans = INT_MAX;
        for(int i=1; i<arr.size(); i++)
        {
            ans = min(ans,arr[i]-arr[i-1]);
        }
        cout << ans << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;
#define _fast_ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define mod 1e9
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define gcd(a,b) __gcd(a,b)
#define count_ones(x) __builtin_popcount(x)
#define _for(k,s,e,inc) for(auto k=s; k<e; k+=inc)
#define _forr(k,s,e,dec) cor(auto k=s, k>=e; k-=dec)

int main()
{
    _fast_;
    int t; cin>>t;
    while(t--)
    {
        string s; cin >> s;
        int n = s.length();
        vector<int> arr;
        arr.pb(0);
        for(int i=0; i<n; i++)
        {
            if(s[i]=='R') arr.pb(i+1);
        }
        arr.pb(n+1);
        int ans = INT_MIN;
        for(int i=0; i<arr.size()-1; i++)
        {
            ans = max(ans,arr[i+1]-arr[i]);
        }
        cout << ans << endl;
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
#define endl '\n'
#define _fast_ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool canVisitLast(int mid, int last, string s)
{
	int *vis = new int[last+1];
	vis[0] = 1;
	int step = mid;
	while(step<last)
	{
		if(s[step]=='R')
		{
			vis[step] = 1;
			step += mid;
		}
		else if(s[step]=='L')
		{
			vis[step] = 1;
			step -= 1;
			if(vis[step]) return false;
		}
		if(vis[step]) return false;
	}
	return true;
}

int solve(string ss)
{
	bool flag = 0;
	for(int i=0; i<ss.length(); i++)
	{
		if(ss[i]!='R')
		{
			flag = 1;
			break;
		}
	}
	if(!flag) return 1;
	int n = ss.length();
	string news = "";
	news += 'x';
	for(auto i : ss) news += i;
	news += 'z';
	int s = 0, e = n+1;
	int ans = 0;
	while(s<=e)
	{
		int mid = (s+e)/2;
		if(canVisitLast(mid,n+1,news))
		{
			ans = mid;
			e = mid-1;
		}
		else
		{
			ans = mid;
			s = mid+1;
		}
	}
	return ans;

}

int main()
{
	_fast_;
	int t; cin >> t;
	while(t--)
	{
		string s; cin >> s;
		cout << solve(s) << endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;
#define _fast_ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define mod 1e9
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define gcd(a,b) __gcd(a,b)
#define count_ones(x) __builtin_popcount(x)
#define _for(k,s,e,inc) for(auto k=s; k<e; k+=inc)
#define _forr(k,s,e,dec) cor(auto k=s, k>=e; k-=dec)

int main()
{
    _fast_;
    int t; cin>>t;
    while(t--)
    {
        string s; cin >> s;
        int n = s.length();
        vector<int> arr;
        arr.pb(0);
        for(int i=0; i<n; i++)
        {
            if(s[i]=='R') arr.pb(i+1);
        }
        arr.pb(n+1);
        int ans = INT_MAX;
        for(int i=1; i<arr.size(); i++)
        {
            ans = max(ans,arr[i]-arr[i-1]);
        }
        cout << ans << endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;
#define _fast_ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define mod 1e9
#define pb(x) push_back(x)
#define eb(x) emplace_back(x)
#define gcd(a,b) __gcd(a,b)
#define count_ones(x) __builtin_popcount(x)
#define _for(k,s,e,inc) for(auto k=s; k<e; k+=inc)
#define _forr(k,s,e,dec) cor(auto k=s, k>=e; k-=dec)

int main()
{
    _fast_;
    int t; cin>>t;
    while(t--)
    {
        string s; cin >> s;
        int n = s.length();
        vector<int> arr;
        arr.pb(0);
        for(int i=0; i<n; i++)
        {
            if(s[i]=='R') arr.pb(i+1);
        }
        arr.pb(n+1);
        int ans = INT_MAX;
        for(int i=0; i<arr.size()-1; i++)
        {
            ans = min(ans,arr[i+1]-arr[i]);
        }
        cout << ans << endl;
    }
    return 0;
}


#include <iostream>
#include <cstring>
using namespace std;
#define endl '\n'
#define _fast_ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

bool canVisitLast(int mid, int last, string s)
{
	int *vis = new int[last];
	memset(vis,0,sizeof(0));
	vis[0] = 1;
	int step = mid;
	while(step<last)
	{
		if(vis[step]) return false;
		if(s[step]=='R')
		{
			vis[step] = 1;
			step += mid;
			if(step>=last) return true;
		}
		else if(s[step]=='L')
		{
			vis[step] = 1;
			step -= 1;
			if(vis[step]) return false;
		}

	}
	return true;
}

int solve(string ss)
{
	bool flag = 0;
	for(int i=0; i<ss.length(); i++)
	{
		if(ss[i]!='R')
		{
			flag = 1;
			break;
		}
	}
	if(!flag) return 1;
	int n = ss.length();
	string news = "";
	news += 'x';
	for(auto i : ss) news += i;
	news += 'z';
	int s = 0, e = n+1;
	int ans = 0;
	while(s<=e)
	{
		int mid = (s+e)/2;
		if(canVisitLast(mid,n+1,news))
		{
			ans = mid;
			e = mid-1;
		}
		else
		{
			s = mid+1;
		}
	}
	return ans;

}

int main()
{
	_fast_;
	int t; cin >> t;
	while(t--)
	{
		string s; cin >> s;
		cout << solve(s) << endl;
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

    //freopen("input.txt","r+",stdin);

    int n, c ;

    cin >> n >> c ;

    vector<int> wordTimes ;

    int x ;

    for(int i = 0; i<n; i++)
    {
        cin >> x ;

        wordTimes.push_back(x);
    }

    int current = 1, max_num = 1 ;

    for(int i = 1 ; i < wordTimes.size(); i++)
    {
        if(wordTimes[i]-wordTimes[i-1]<=c)
        {
            current++ ;
        }
        else
        {
            if(current>max_num)
            {
                max_num = current;
            }
            current = 1;
        }

        if(i==(wordTimes.size()-1))
            if(current>max_num)
            {
                max_num = current;
            }
       // cout << current << '\t'<< max_num << '\t'<<i <<'\n';
    }

    if(max_num==0)
    {
        max_num=1;
    }

    cout << max_num << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

    //freopen("input.txt","r+",stdin);

    long n, c ;

    cin >> n >> c ;

    vector<int> wordTimes ;

    long x ;

    for(int i = 0; i<n; i++)
    {
        cin >> x ;

        wordTimes.push_back(x);
    }

    int current = 1, max_num = 1 ;

    for(int i = 1 ; i < wordTimes.size(); i++)
    {
        if(wordTimes[i]-wordTimes[i-1]<=c)
        {
            current++ ;
        }
        else
        {
            if(current>max_num)
            {
                max_num = current;
            }
            current = 1;
        }

        if(i==(wordTimes.size()-1))
            if(current>max_num)
            {
                max_num = current;
            }
       // cout << current << '\t'<< max_num << '\t'<<i <<'\n';
    }

    if(max_num==0)
    {
        max_num=1;
    }

    cout << max_num << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

    freopen("input.txt","r+",stdin);

    long n, c ;

    cin >> n >> c ;

    long x ;

    int current = 0, currentBefore = 0, max_num = 1 ;

    for(int i = 0; i<n; i++)
    {
        cin >> current;

        if(current-currentBefore > c)
        {
            max_num = 0 ;
        }

        max_num++ ;

        currentBefore = current;
    }

    cout << max_num << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

    //freopen("input.txt","r+",stdin);

    int n, c ;

    cin >> n >> c ;

    vector<int> wordTimes ;

    int x ;

    for(int i = 0; i<n; i++)
    {
        cin >> x ;

        wordTimes.push_back(x);
    }

    int current = 0, max_num = 1 ;

    for(int i = 0 ; i < wordTimes.size()-1; i++)
    {
        if(wordTimes[i+1]-wordTimes[i]<=c)
        {
            current++ ;
        }
        else
        {
            current = 1;
        }

        if(current>max_num)
        {
            max_num = current;
        }
    }

    if(max_num==0)
    {
        max_num=1;
    }

    cout << max_num << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{

//    freopen("input.txt","r+",stdin);

    long n, c ;

    cin >> n >> c ;

    long x ;

    int current = 0, currentBefore = 0, max_num = 1 ;

    for(int i = 0; i<n; i++)
    {
        cin >> current;

        if(current-currentBefore > c)
        {
            max_num = 0 ;
        }

        max_num++ ;

        currentBefore = current;
    }

    cout << max_num << endl;

    return 0;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int n, i,  c, total=0;

   cin >> n >> c;

   int arr[n];

   for(i=0; i<n; i++)
   {
       cin >> arr[i];
   }

   for(i=0; i<n-1; i++)
   {
       if (n==1) {total=1; break;}
       if((arr[i+1]-arr[i])<=c) total++;
       else total=0;
       //cout << total << endl;
       if(i==n-2 && (arr[n-1]-arr[n-2])<=c) total++;
       //cout << total << endl;
   }

   cout << total << endl;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n, c, ans=0, x=0, data;

    cin >> n >> c;

    for(int i=0; i<n; i++)
    {
        cin >> data;
        if(data-x > c) ans=0;
        ans++;
        x=data;
    }
    cout << ans << endl;

return 0;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   long long int n, i,  c, total=0;

   cin >> n >> c;

   int arr[n+1];
   arr[0]=0;

   for(i=1; i<n+1; i++)
   {
       cin >> arr[i];
   }

   if (n==1) {total=1;}

   for(i=1; i<n; i++)
   {
       if((arr[i]-arr[i-1])<=c) total++;
       else total=0;
       //cout << total << endl;
       if(i==n-1 && (arr[n]-arr[n-1])<=c) total++;
       //cout << total << endl;
   }

   cout << total << endl;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int n, i,  c, total=1;

   cin >> n >> c;

   int arr[n];

   for(i=0; i<n; i++)
   {
       cin >> arr[i];
   }

   for(i=0; i<n-1; i++)
   {
       if((arr[i+1]-arr[i])<c) total++;
   }

   cout << total << endl;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   long long int n, i,  c, total=0;

   cin >> n >> c;

   int arr[n];

   for(i=0; i<n; i++)
   {
       cin >> arr[i];
   }

    if (n==1) {total=1;}
   for(i=0; i<n-1; i++)
   {
       if((arr[i+1]-arr[i])<=c) total++;
       else total=0;
       //cout << total << endl;
       if(i==n-2 && (arr[n-1]-arr[n-2])<=c) total++;
       //cout << total << endl;
   }

   cout << total << endl;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   long long int n, i,  c, total=1;

   cin >> n >> c;

   int arr[n];

   for(i=0; i<n; i++)
   {
       cin >> arr[i];
   }

    if (n==1) {total=1;}
   for(i=0; i<n-1; i++)
   {
       if((arr[i+1]-arr[i])<=c) total++;
       else total=0;
       //cout << total << endl;
       if(i==n-2 && (arr[n-1]-arr[n-2])<=c) total++;
       //cout << total << endl;
   }

   cout << total << endl;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int n, i,  c, total=1;

   cin >> n >> c;

   int arr[n];

   for(i=0; i<n; i++)
   {
       cin >> arr[i];
   }

   for(i=0; i<n-1; i++)
   {
       if((arr[i+1]-arr[i])<=c) total++;
       else total=0;
       //cout << total << endl;
       if(i==n-2 && (arr[n-1]-arr[n-2])<=c) total++;
       //cout << total << endl;
   }

   cout << total << endl;
}


#include<iostream>
#include<bits/stdc++.h>

using namespace std;

int main()
{
   int n, i,  c, total=0;

   cin >> n >> c;

   int arr[n];

   for(i=0; i<n; i++)
   {
       cin >> arr[i];
   }

   for(i=0; i<n-1; i++)
   {
       if((arr[i+1]-arr[i])<=c) total++;
       else total=0;
       //cout << total << endl;
       if(i==n-2 && (arr[n-1]-arr[n-2])<=c) total++;
       //cout << total << endl;
   }

   cout << total << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=1;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int j=n-1;j>=1;j--){
		if(arr[j]-arr[j-1]<=c){
			cnt++;
		}
		else {
		cnt=1;
		}
	}
	cout << cnt;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, cnt=1;
	cin >> n >> c;
	int arr[n];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=n-1;i>=1;i--){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else break;
	}
	cout << cnt;
	return 0;
}


#include<iostream>
using namespace std;
int n,c;
main()
{
	cin>>n>>c;
	int i,a[n],s=1;
	for (i=0; i<n; i++)
		cin>>a[i];
	for (i=1; i<n; i++)
		if (a[i]-a[i-1]<=c) s++; else s=1;
	cout<<s;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=0;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=n-1;i>0;i--){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else break;
	}
	cout << cnt+1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=1;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=1;i<n;i++){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else {
		cnt=1;
		}
	}
	cout << cnt;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=0;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=n;i>=0;i--){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else break;
	}
	cout << cnt;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=1;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int j=1;j<n;j++){
		if(arr[j]-arr[j-1]<=c){
			cnt++;
		}
		else {
		cnt=1;
		}
	}
	cout << cnt;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=0;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=n-1;i>=0;i--){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else break;
	}
	cout << cnt+1;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n,c, arr[n], cnt=0;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=n;i>=0;i--){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else break;
	}
	cout << cnt;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n,c, arr[n], cnt=0, cntno=1;
	cin >> n >> c;
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	for(int i=n-1;i>=1;i--){
		if(arr[i]-arr[i-1]<=c){
			cnt++;
		}
		else {
		break;
		cout << cntno;
		}
	}
	cout << cnt+1;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int ara[100005];
vector<int>vec;
int main()
{
    int a,b,C,i,j,k,n,sum=0,flag=0,cnt=0;
    cin>>n>>C;

    if(n==1){
        cin>>i;
        if(i<=C) cnt=1;
        else cnt=0;
    }
    else{
        for(i=1;i<=n;i++){
            cin>>ara[i];
        }
        for(i=2;i<=n;i++){
            if(abs(ara[i]-ara[i-1])<=C) vec.push_back(ara[i-1]);
            else vec.clear();
        }

        if(abs(ara[n]-ara[n-1]) <=C) vec.push_back(ara[n]);
        cnt=vec.size();
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int ara[100005];
int main()
{
    int a,b,C,i,j,k,n,sum=0,flag=0,cnt=0;
    cin>>n>>C;

    if(n==1) cnt=1;
    else{
        for(i=1;i<=n;i++){
            cin>>ara[i];
        }
        for(i=1;i<n;i++){
            if(ara[i+1]-ara[i]<=C) cnt++;
            else cnt=0;
        }
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int ara[100005];
int main()
{
    int a,b,C,i,j,k,n,sum=0,flag=0,cnt=0;
    cin>>n>>C;

    if(n==1) cnt=1;
    else{
        for(i=1;i<=n;i++){
            cin>>ara[i];
        }
        for(i=1;i<n;i++){
            if(ara[i+1]-ara[i]<=C) cnt++;
            else cnt=0;
        }
        cnt++;
        if(ara[i]-ara[i-1]>C) cnt=0;
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int ara[100005];
vector<int>vec;
int main()
{
    int a,b,C,i,j,k,n,sum=0,flag=0,cnt=0;
    cin>>n>>C;

    if(n==1) cnt=1;
    else{
        for(i=1;i<=n;i++){
            cin>>ara[i];
        }
        for(i=2;i<=n;i++){
            if(abs(ara[i]-ara[i-1])<=C) vec.push_back(ara[i-1]);
            else vec.clear();
        }

        if(abs(ara[n]-ara[n-1]) <=C) vec.push_back(ara[n]);
        cnt=vec.size();
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int ara[100005];
vector<int>vec;
int main()
{
    int a,b,C,i,j,k,n,sum=0,flag=0,cnt=0;
    cin>>n>>C;

    if(n==1){
        cin>>i;
        cnt=1;
    }
    else{
        for(i=1;i<=n;i++){
            cin>>ara[i];
        }
        for(i=2;i<=n;i++){
            if(abs(ara[i]-ara[i-1])<=C) vec.push_back(ara[i-1]);
            else vec.clear();
        }

        if(abs(ara[n]-ara[n-1]) <=C) vec.push_back(ara[n]);
        cnt=vec.size();
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int ara[100005];
int main()
{
    int a,b,C,i,j,k,n,sum=0,flag=0,cnt=0;
    cin>>n>>C;

    if(n==1){
        cin>>i;
        cnt=1;
    }
    else{
        for(i=1;i<=n;i++){
            cin>>ara[i];
        }
        for(i=1;i<n;i++){
            if(ara[i+1]-ara[i]<=C) cnt++;
            else cnt=0;
        }
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
 int main ()
 {
     long long int n,a,c,s=0,x=1;
     cin>>n>>c;
     while(n--)
     {
         cin>>a;
         if(abs(a-s)<=c)
            x++;
         else
            x=1;
        s=a;
     }
     cout<<x<<endl;

     return 0;
 }


#include<bits/stdc++.h>
using namespace std;
 int main ()
 {
     long long int n,a,c,s=0,x=1;
     cin>>n>>c>>a;
     if(n==1)
     {
         cout<<x<<endl;
         return 0;
     }
     s=a;
     n--;
     while(n--)
     {
         cin>>a;
         if(a-s<=c)
            x++;
         else
            x=1;
        s=a;
     }
     printf("%lld",x);

     return 0;
 }


#include<bits/stdc++.h>
using namespace std;
 int main ()
 {
     long long int n,a,c,s=0,x=1;
     cin>>n>>c;
     if(n==1)
     {
         cout<<n<<endl;
         return 0;
     }
     while(n--)
     {
         cin>>a;
         if(a-s<=c)
            x++;
         else
            x=1;
        s=a;
     }
     cout<<x<<endl;

     return 0;
 }


#include<bits/stdc++.h>
using namespace std;
 int main ()
 {
     long long int n,a,c,s=0,x=0;
     cin>>n>>c;
     if(n==1)
     {
         cout<<1<<endl;
         return 0;
     }
     //s=a;
     //n--;
     while(n--)
     {
         cin>>a;
         if(a-s<=c)
            x++;
         else
            x=1;
        s=a;
     }
     printf("%lld",x);

     return 0;
 }


#include<bits/stdc++.h>
using namespace std;
 int main ()
 {
     long long int n,a,c,s=0,x=1;
     cin>>n>>c;
     while(n--)
     {
         cin>>a;
         if(a-s<=c)
            x++;
         else
            x=1;
        s=a;
     }
     cout<<x<<endl;

     return 0;
 }


#include<bits/stdc++.h>
using namespace std;
main(){
int i,j,k,l,m,n,p,q,x[10000];
while(cin>>m>>n){ k=1;
for(i=0;i<m;i++){
    cin>>x[i];
}for(i=1;i<m;i++){
    j=x[i]-x[i-1];
    if(j>n)k=1;
    else k++;
}
cout<<k<<endl;

} return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n,p,q;
while(cin>>m>>n){ k=1;l=0;
for(i=0;i<m;i++){
    cin>>j;
    if(j-l>=n) k=1;
    else k++;
    l=j;
}

cout<<k<<endl;

} return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){ ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
long long i,j,k,l,m,n,p,q,x[10000];
while(cin>>m>>n){ k=1;l=0;
for(i=0;i<m;i++){
    cin>>x[i];}
    for(i=1;i<m;i++){
    if(x[i]-x[i-1]>n) k=1;
    else k++;
}
cout<<k<<endl;
} return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n,p,q,x[10000];
while(scanf("%ld%ld",&m,&n)){ k=1;l=0;
for(i=0;i<m;i++){
    scanf("%ld",&x[i]);
    }
    for(i=1;i<m;i++){
    if(x[i]-x[i-1]>n) k=1;
    else k++;
}

printf("%ld\n",k);

} return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n,p,q;
while(cin>>m>>n){ k=1;l=0;
for(i=0;i<m;i++){
    cin>>j;
    if(j-l>n) k=0;
    else k++;
    l=j;
}

cout<<k<<endl;

} return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n,p,q;
while(cin>>m>>n){ k=1;l=0;
for(i=0;i<m;i++){
    cin>>j;
    if(j-l>n) k=1;
    else k++;
    l=j;
}

cout<<k<<endl;

} return 0;
}


#include<stdio.h>
int main() {
	int n , c, t[100000];
	scanf("%d %d",&n, &c);
	int count = 0;
	for(int i = 0; i < n; i++) {
		scanf("%d",&t[i]);
	}
	for(int i = 1; i < n; i++) {
		if(t[i] - t[i - 1] <= c) {
			count++;
		}
		else {
			count = 0;
		}
	}
	count = count + 1;
	printf("%d\n",count);
return 0;
}


#include<bits/stdc++.h>
using namespace std;
main(){
long long i,j,k,l,m,n,p,q,x[10000];
while(cin>>m>>n){ k=1;l=0;
for(i=0;i<m;i++){
    cin>>x[i];}
    for(i=1;i<m;i++){
    if(x[i]-x[i-1]>n) k=1;
    else k++;

}

cout<<k<<endl;

} return 0;
}


#include <iostream>
using namespace std;

int main() {
	int a, b, g;
	cin>>a;
	cin>>b;
	g=0;
	int c [a];
	for(int i=0;i<a;i++) {
		cin>>c[i];
	}
	for(int i=1;i<a;i++) {
		if(c[i]-c[i-1]<b+1) {
		if(g==0) g+=2;
		else g++;
}
		else g=0;

}
	cout<<g;
}


#include <iostream>
using namespace std;

int main() {
	long long  a, b, g;
	cin>>a;
	cin>>b;
	g=0;
	long long c [a];
	for(int i=0;i<a;i++) {
		cin>>c[i];
	}
	if(a==1) cout<<1;
	else {

	for(int i=1;i<a;i++) {
		if(c[i]-c[i-1]<b+1) g++;
		else g=0;

}
	cout<<g+1;
}
}


#include <iostream>
using namespace std;

int main() {
	int a, b, g;
	cin>>a;
	cin>>b;
	g=0;
	int c [a];
	for(int i=0;i<a;i++) {
		cin>>c[i];
	}
	if(a==1) cout<<1;
	else {

	for(int i=1;i<a;i++) {
		if(c[i]-c[i-1]<b+1) {
		if(g==0) g+=2;
		else g++;
}
		else g=0;

}
	cout<<g;
}
}


#include <iostream>
using namespace std;

int main() {
	long long  a, b, g;
	cin>>a;
	cin>>b;
	g=0;
	long long c [a];
	for(int i=0;i<a;i++) {
		cin>>c[i];
	}
	if(a==1) cout<<1;
	else {

	for(int i=1;i<a;i++) {
		if(c[i]-c[i-1]<b+1) {
		if(g==0) g+=2;
		else g++;
}
		else g=0;

}
	cout<<g;
}
}


#include <iostream>
using namespace std;

int main() {
	int a, b, g;
	cin>>a;
	cin>>b;
	g=0;
	int c [a];
	for(int i=0;i<a;i++) {
		cin>>c[i];
	}
	for(int i=1;i<a;i++) {
		if(c[i]-c[i-1]<b+1) {
		if(g==0) g+=2;
		else g++;
}
		else g=0;
		cout<<g<<endl;

}
	cout<<g;
}


#include <iostream>
using namespace std;

int main() {
	long long  a, b, g;
	cin>>a;
	cin>>b;
	g=0;
	long long c [a];
	for(int i=0;i<a;i++) {
		cin>>c[i];
	}
	if(a==1) cout<<1;
	else {

	for(int i=1;i<a;i++) {
		if(c[i]-c[i-1]<b+1) g++
		else g=0;

}
	cout<<g+1;
}
}


#include <bits/stdc++.h>
using namespace std;
long long i,n,c,a[10007],s;
int main()
{
    cin>>n>>c;
     for(i=1;i<=n;i++)cin>>a[i];
     for(i=1;i<=n;i++){
       if(a[i+1]-a[i]<c)s++;
       else s=1;
     }
     cout<<s<<endl;
}