#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  long long t = 1;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long l, r;
    l = r = 0;
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == 'L')
        l++;
      else
        r++;
    }
    if (r == 0)
      cout << s.length() + 1;
    else if (l == 0)
      cout << 1;
    else {
      long long m = INT32_MIN, len = 1;
      for (long long i = 1; i < s.length(); i++) {
        if (s[i] == 'R') len = 1;
        if (s[i] == 'L' && s[i] == s[i - 1]) {
          len++;
        }
        m = max(m, len);
      }
      cout << m + 1;
    }
    cout << "\n";
  }
  return 0;
}
