#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int t;
  cin >> t;
  while (t--) {
    cin >> str;
    int cnt = 1;
    int max = 1;
    for (int i = 0; i < str.length(); i++) {
      if (str[i] == 'L') {
        cnt += 1;
        if (max < cnt) max = cnt;
      } else if (str[i] == 'R') {
        cnt = 1;
      }
    }
    cout << max << endl;
  }
  return 0;
}
