#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long r = 0, l = 0, m = 0, ma = 0;
    for (long long i = s.length() - 1; i >= 0; i--) {
      if (s[i] == 'R') {
        r++;
      } else {
        l++;
      }
    }
    m = 0;
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == 'L') {
        if (s[i - 1] != 'L') {
          m = 1;
        } else if (s[i - 1] == 'L') {
          m++;
        }
        if (m > ma) {
          ma = m;
        }
      }
      if (s[i] == 'R') {
        continue;
      }
    }
    if (l == s.length()) {
      cout << l + 1 << "\n";
    } else if (r == s.length()) {
      cout << "1\n";
    } else {
      cout << ma + 1 << "\n";
    }
  }
}
