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