#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    char s[200001];
    cin >> s;
    int len = strlen(s);
    int count = 0;
    int max = 0;
    for (int i = 0; i < len; i++) {
      if (s[i] == 'L')
        count++;
      else
        count = 0;
      if (count > max) max = count;
    }
    cout << max + 1 << endl;
  }
  return 0;
}
