#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string cad;
    cin >> cad;
    int l = 0, r = 0;
    for (int i = 0; i < cad.size(); i++)
      if (cad[i] == 'R')
        l = max(l, r), r = 0;
      else
        r += 1;
    l = max(l, r);
    cout << l + 1 << "\n";
  }
}
