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