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