#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    string str;
    cin >> str;
    vector<long long> v1;
    v1.push_back(0);
    for (long long i = 0; i < str.length(); i++) {
      if (str[i] == 'R') v1.push_back(i + 1);
    }
    v1.push_back(str.length() + 1);
    long long ans = 0;
    for (long long i = 0; i < v1.size() - 1; i++)
      ans = max(ans, abs(v1[i] - v1[i + 1]));
    cout << ans << "\n";
  }
  return 0;
}
