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