#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  while (n > 0) {
    string o;
    cin >> o;
    int counter = 0, max_area = 0;
    bool fact = true;
    for (int i = 0; i < o.size(); i++) {
      if (o[i] == 'L') {
        fact = false;
        break;
      }
    }
    if (fact == true) {
      cout << 1 << endl;
    } else {
      for (int i = 0; i < o.size(); i++) {
        if (o[i] == 'L') {
          counter++;
        }
        if (o[i] == 'R' || i + 1 == o.size()) {
          max_area = max(max_area, counter);
          counter = 0;
        }
      }
      cout << max_area + 1 << endl;
    }
    n--;
  }
  return 0;
}
