#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  ios::sync_with_stdio(0);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int last = -1;
    int min = -1;
    for (int i = 0; i < s.length(); ++i) {
      if (s[i] == 'R') {
        int diff = i - last;
        last = i;
        if (diff > min) min = diff;
      }
    }
    int diff = s.length() - last;
    if (diff > min) min = diff;
    cout << min << endl;
  }
}
