#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, k, t, l, p, q, r, ts;
  cin >> ts;
  while (ts--) {
    getchar();
    string s;
    cin >> s;
    int ans = 0, l = 0;
    for (i = 0; i < s.size(); i++) {
      if (s[i] == 'L')
        l++;
      else
        l = 0;
      ans = max(ans, l);
    }
    cout << ans + 1 << endl;
  }
}
