fork download
  1. // To understand what is happening in this file, please go to the end of the file.
  2.  
  3. #include "bits/stdc++.h"
  4.  
  5. #define int long long
  6. #define vi vector< int >
  7. #define fastIO() ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
  8. #define all(x) x.begin(),x.end()
  9. #define endl '\n'
  10.  
  11. using namespace std;
  12.  
  13. /*
  14.  
  15.  
  16.   ▄████ ██▓ ██▓▄▄▄█████▓ ▄████▄ ██░ ██
  17.  ██▒ ▀█▒▓██▒ ▓██▒▓ ██▒ ▓▒▒██▀ ▀█ ▓██░ ██▒
  18. ▒██░▄▄▄░▒██░ ▒██▒▒ ▓██░ ▒░▒▓█ ▄ ▒██▀▀██░
  19. ░▓█ ██▓▒██░ ░██░░ ▓██▓ ░ ▒▓▓▄ ▄██▒░▓█ ░██
  20. ░▒▓███▀▒░██████▒░██░ ▒██▒ ░ ▒ ▓███▀ ░░▓█▒░██▓
  21.  ░▒ ▒ ░ ▒░▓ ░░▓ ▒ ░░ ░ ░▒ ▒ ░ ▒ ░░▒░▒
  22.   ░ ░ ░ ░ ▒ ░ ▒ ░ ░ ░ ▒ ▒ ░▒░ ░
  23. ░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░
  24.   ░ ░ ░ ░ ░ ░ ░ ░ ░
  25.  
  26. */
  27.  
  28. template<typename typC> istream &operator>>(istream &cin,vector<typC> &a) { for (auto &x:a) cin>>x; return cin; }
  29. template<typename typC> ostream &operator<<(ostream &cout,const vector<typC> &a) { int n=a.size(); if (!n) return cout; cout<<a[0]; for (int i=1; i<n; i++) cout<<' '<<a[i]; return cout; }
  30.  
  31.  
  32.  
  33. void itIsADream(){
  34. string s; cin >> s;
  35. vi pos;
  36. pos.push_back(0);
  37. for (int i = 0; i < s.size(); i++) {
  38. if (s[i] == 'R') pos.push_back(i + 1);
  39. }
  40. pos.push_back(s.size() + 1);
  41. int ans = 0;
  42. for (int i = 0; i < pos.size() - 1; i++) {
  43. ans = max(ans, pos[i + 1] - pos[i]);
  44. }
  45. cout << ans << endl;
  46. }
  47.  
  48. int32_t main()
  49. {
  50. fastIO();
  51. // freopen("input.txt", "r", stdin);
  52. // freopen("output.txt", "w", stdout);
  53. int t = 1;
  54. cin >> t;
  55. while (t--)
  56. {
  57. itIsADream();
  58. }
  59. return 0;
  60. }
  61.  
  62. // to understand what is happening in this file, please go to the starting of the file.
Success #stdin #stdout 0.01s 5308KB
stdin
Standard input is empty
stdout
1