#include <bits/stdc++.h>
using namespace std;
int q[200010];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int l = s.length();
    if (l == 1) {
      if (s[0] == 'L') {
        cout << 2 << endl;
      } else {
        cout << 1 << endl;
      }
      continue;
    }
    int flag = 0;
    for (int i = 0; i < l; i++) {
      if (s[i] == 'R') {
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      cout << l + 1 << endl;
      continue;
    }
    int k = 1;
    q[0] = 0;
    for (int i = 0; i < l; i++) {
      if (s[i] == 'R') {
        q[k++] = i + 1;
      }
    }
    q[k] = l + 1;
    int maxn = 0;
    for (int i = 1; i <= k; i++) {
      int x = q[i] - q[i - 1];
      maxn = max(maxn, x);
    }
    cout << maxn << endl;
  }
  return 0;
}
