#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, len, counter, max_l = 0;
  char s[200000];
  cin >> t;
  while (t--) {
    max_l = 0;
    counter = 0;
    cin >> s;
    len = strlen(s);
    for (int i = 0; i < len; i++) {
      if (s[i] == 'L') {
        counter++;
        if (counter > max_l) max_l = counter;
      } else
        counter = 0;
    }
    cout << max_l + 1 << endl;
  }
  return 0;
}
