#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int n = s.size();
    int maxlen = 0;
    int len = 1;
    for (int i = 0; i < n; ++i) {
      if (s[i] == 'L')
        len++;
      else {
        maxlen = max(maxlen, len);
        len = 1;
      }
    }
    maxlen = max(maxlen, len);
    cout << maxlen << '\n';
  }
}
