#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tests;
  cin >> tests;
  while (tests--) {
    string s;
    cin >> s;
    long long v = 0;
    long long ma = 0;
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == 'L') {
        ++v;
      } else {
        ma = max(ma, v);
        v = 0;
      }
      if (i == s.length() - 1) ma = max(ma, v);
    }
    cout << ma + 1 << endl;
  }
  return 0;
}
