#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
const int M = 1e5 + 2;
const long long mod = 1e9 + 7;
const int inf = 1e9;
const long long INF = 1e18;
void data() {}
int t, n, d, len;
string s;
int main() {
  data();
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> s;
    d = len = 1;
    for (int i = 0; i < (int)s.size(); ++i) {
      if (s[i] == 'L')
        len++;
      else {
        d = max(d, len);
        len = 1;
      }
    }
    d = max(d, len);
    cout << d << '\n';
  }
}
