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