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