#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m(0), r;
  string s;
  cin >> n;
  for (int j = 1; j <= n; j++) {
    cin >> s;
    for (int i = 0; i <= s.size(); i++)
      if (s[i] == 'L') {
        m++;
      } else {
        r = max(r, m);
        m = 0;
      }
    cout << r + 1 << endl;
    r = 0;
  }
  return 0;
}
