#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long i, j, k, l, m, n, cnt = 0, ma = 0;
    string str;
    cin >> str;
    l = str.length();
    for (i = 0; i < l; i++) {
      if (str[i] == 'L') {
        while (str[i] == 'L' && i < l) {
          cnt++;
          i++;
        }
        ma = max(ma, cnt);
        cnt = 0;
      }
    }
    cout << ma + 1 << endl;
  }
}
