Skip to content

Instantly share code, notes, and snippets.

@tony9402
Created March 13, 2020 16:57
Show Gist options
  • Save tony9402/155a377ae6c4e8cb3178bea1b94b9b91 to your computer and use it in GitHub Desktop.
Save tony9402/155a377ae6c4e8cb3178bea1b94b9b91 to your computer and use it in GitHub Desktop.
Codeforces
#include<bits/stdc++.h>
#define endl "\n";
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
string arr; cin >> arr;
arr = "S" + arr + "E";
int maxi = 0, idx = 0;
for(int i=1;i<arr.size();i++){
if (arr[i] == 'R' || arr[i] == 'E') {
maxi = max(maxi, i - idx);
idx = i;
}
}
cout << maxi << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment