#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  string p;
  while (t--) {
    int c = 0, r = 0;
    cin >> p;
    for (int i = 0; i < p.length(); i++) {
      if (p[i] == 'L') {
        c++;
        r = max(c, r);
      } else
        c = 0;
    }
    cout << r + 1 << endl;
  }
}
