#include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int main() {
  int k;
  cin >> k;
  string arr;
  while (k--) {
    cin >> arr;
    int n = arr.length();
    int maxLen = 0;
    for (int i = 0; i < n; i++) {
      int len = 0;
      while (arr[i] == 'L') {
        len++;
        i++;
        if (i == n) break;
      }
      maxLen = max(maxLen, len);
    }
    cout << maxLen + 1 << endl;
  }
  return 0;
}
