#include <bits/stdc++.h>
using std ::cin;
using std::cout;
using std::endl;
using std::string;
int main() {
  int num;
  cin >> num;
  string str;
  int max = 0, temp = 0;
  string::iterator j;
  cin.ignore();
  for (int i = 0; i < num; ++i) {
    getline(cin, str);
    for (j = str.begin(), max = 0, temp = 0; j != str.end(); ++j) {
      if (str[j - str.begin()] == 'R') {
        max = max < temp ? temp : max;
        temp = 0;
      } else {
        ++temp;
      }
    }
    max = max < temp ? temp : max;
    cout << max + 1 << endl;
  }
  return 0;
}
