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