#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sc(x) scanf("%d", &x)
#define sc2(x, y) scanf("%d%d", &x, &y)
#define sc3(x, y, z) scanf("%d%d%d", &x, &y, &z)
#define sc4(x, y, z, t) scanf("%d%d%d%d", &x, &y, &z, &t)
#define print(x) printf("%d ", x)
#define println(x) printf("%d\n", x)
#define println2(x, y) printf("%d %d\n", x, y)
#define println3(x, y, z) printf("%d %d %d\n", x, y, z)
#define println4(x, y, z, t) printf("%d %d %d %d\n", x, y, z, t)
#define mp make_pair
#define pb push_back
#define ft first
#define sd second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define endl '\n' // CommentInInteractive
#define DB(x) cerr << #x << " = " << x << endl
const ld eps = 1e-6;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
void solve() {
string s;
cin >> s;
int n = sz(s);
cout << "Input string [" << s << "], length = " << n << endl;
if (n == 0) {
cout << "No input" << endl; return;
}
vector<int> dp(n,0);
dp[0] = (s[0] == 'L');
int ans = (s[0] == 'L');
for (int i = 1; i < n; i++) {
if (s[i] == 'L') {
dp[i] = dp[i - 1] + 1;
ans = max(ans, dp[i]);
}
}
cout << ans + 1 << endl;
}
//#define FILES
//#define TIME
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
#ifdef FILES
freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
#endif
auto start = chrono::high_resolution_clock::now();
int t; sc(t);
while (t--) solve();
auto stop = chrono::high_resolution_clock::now();
#ifdef TIME
cerr << chrono::duration_cast <chrono::milliseconds> (stop - start).count() << " ms\n";
#endif
return 0;
}
I2RlZmluZSBfQ1JUX1NFQ1VSRV9OT19XQVJOSU5HUwoKI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVza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