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