#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  string str;
  cin >> t;
  while (t--) {
    cin >> str;
    int ans = 0;
    int dist = 0;
    for (int i = 0; i < str.length(); i++) {
      dist++;
      if (str[i] == 'R') {
        ans = max(ans, dist);
        dist = 0;
      }
    }
    ans = max(ans, dist + 1);
    cout << ans << '\n';
  }
  return 0;
}
