#include <bits/stdc++.h>
using namespace std;
int num[200005];
int main() {
  int t;
  cin >> t;
  string s;
  while (t--) {
    cin >> s;
    int l = s.length();
    num[0] = -1;
    int x = 1;
    for (int i = 0; i < l; i++) {
      if (s[i] == 'R') {
        num[x] = i;
        x = x + 1;
      }
    }
    num[x] = l;
    int max = 0;
    for (int i = 1; i <= x; i++) {
      if (num[i] - num[i - 1] > max) max = num[i] - num[i - 1];
    }
    cout << max << endl;
  }
}
