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