#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    char ch[200002];
    cin >> ch;
    int n = strlen(ch);
    int maxi = -1;
    int pos = 0;
    int flag = 0;
    for (int i = 0; i < n; i++) {
      if (ch[i] == 'R') {
        flag = 1;
        if (maxi < (i + 1) - pos) {
          maxi = i + 1 - pos;
        }
        pos = i + 1;
      }
    }
    if (flag == 0)
      maxi = n + 1;
    else {
      for (int i = n - 1; i >= 0; i--) {
        if (ch[i] == 'R') {
          if (maxi < n - i) {
            maxi = n - i;
          }
          break;
        }
      }
    }
    cout << maxi << endl;
  }
  return 0;
}
