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