#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    s.push_back('R');
    int cur = 0;
    int mx = 0;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == 'R') {
        mx = max(mx, i + 1 - cur);
        cur = i + 1;
      }
    }
    if (mx == 0) {
      cout << s.size();
      cout << "\n";
    } else
      cout << mx << "\n";
  }
}
