#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, i, c = 0;
  long long int max = INT_MIN;
  cin >> t;
  while (t--) {
    string str;
    cin >> str;
    c = 0;
    max = INT_MIN;
    for (i = 0; i < str.length(); i++) {
      if (str.at(i) == 'L')
        c++;
      else if (str.at(i) == 'R')
        c = 0;
      if (c > max) max = c;
    }
    cout << max + 1 << "\n";
  }
  return 0;
}
