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