#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int f = 0, n = s.length();
    int ans = -1e9;
    int il = -1, ir = n;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == 'R') {
        f = 1;
        ans = max(ans, abs(il - i));
        il = i;
      }
    }
    ans = max(ans, abs(ir - il));
    if (f == 0)
      cout << s.length() + 1 << endl;
    else
      cout << ans << endl;
  }
  return 0;
}
