Problem:


Score : 100 points

Problem Statement

We have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.

Find the maximum number of consecutive rainy days in this period.

Constraints

|S| = 3

Each character of S is S or R.

Input

Input is given from Standard Input in the following format:

S

Output

Print the maximum number of consecutive rainy days in the period.

Sample Input 1

RRS

Sample Output 1

2

We had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.

Sample Input 2

SSS

Sample Output 2

0

It was sunny throughout the period. We had no rainy days, so we should print 0.

Sample Input 3

RSR

Sample Output 3

1

We had rain on the 1-st and 3-rd days - two "streaks" of one rainy day, so we should print 1.



Sample input:
RRS


Sample output:
2

Submission status: Accepted

Solution code:
S = input()
if S[0] == "R":
    if S[1] == "R":
        if S[2] == "R":
            print(3)
        else:
            print(2)
    else:
        print(1)
elif S[1] == "R":
    if S[2] == "R":
        print(2)
    else:
        print(1)
elif S[2]  == "R":
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
S = list(input())
stre = 0
ans = 0
for i in S:
    if i == "R":
        stre += 1
        if stre > ans:
            ans = stre
    else:
        stre = 0
print(ans)

Submission status: Accepted

Solution code:
data = input()
if 'RRR' in data:
    print(3)
elif 'RR' in data:
    print(2)
elif 'R' in data:
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
days = input()
ans = 0
for i in days:
    if i == 'R':
        ans += 1
        break
for i in range(1,len(days)):
    if days[i] == days[i-1] and days[i] == 'R':
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    cnt = S.count("R")
    if cnt == 2 and S[1]=="S":
        print(1)
    else:
        print(cnt)

    
if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
s = input()

count = s.count('R')
if count == 2:
    if s[1] == 'S':
        print(1)
        exit()
    else:
        print(2)
        exit()
print(count)

Submission status: Accepted

Solution code:
a=input()
b=0
if a=="SSS": b=0
elif a=="SSR" or a=="SRS" or a=="RSS" or a=="RSR": b=1
elif a=="SRR" or a=="RRS": b=2
elif a=="RRR": b=3
print(b)

Submission status: Accepted

Solution code:
#x = int(input())
#A = list(map(int, input().split()))
#l, r, d = map(int, input().split())
S = input()

if S.count("R") == 0:
  print(0)
elif S.count("R") == 1:
  print(1)
elif S.count("R") == 3:
  print(3)
elif S.count("R") == 2:
  if S[1] == "S":
    print(1)
  else:
    print(2)

Submission status: Accepted

Solution code:
s=input()
if s.count("R")==3 or s.count("R")==0 or s.count("R")==1:
    print(s.count("R"))
elif s=="RSR":
    print(1)
else:
    print(2)

Submission status: Accepted

Solution code:
s = input()

if s == 'RRR':
    print(3)
    exit()
if s.find('RR') >= 0:
    print(2)
    exit()
if s.find('R') >= 0:
    print(1)
    exit()
print(0)

Submission status: Accepted

Solution code:
input_str = input()
cnt = 0
max_cnt = 0
for tmp in input_str:
    if tmp == "R":
        cnt +=1
        max_cnt = max(cnt, max_cnt)
    else:
        cnt = 0
        
print(max_cnt)

Submission status: Accepted

Solution code:
s = input()

if s == "RRR":
    print(3)
elif s == "SRR" or s == "RRS":
    print(2)
elif s == "SSS":
    print(0)
else:
    print(1)

Submission status: Accepted

Solution code:
s=input()
if s[0] == s[1] == s[2] == 'R':
  print(3)
elif s[0] == s[1] =='R' or s[1] ==s[2] =='R':
  print(2)
elif s[0] =='R' or s[1] =='R' or s[2] =='R':
  print(1)
else:
  print(0)

Submission status: Accepted

Solution code:
S = input()
cnt = 0
ans = 0
for i in range(3):
    if S[i] == "R":
        cnt += 1
        ans = max(cnt, ans)
    else:
      cnt = 0
print(ans)

Submission status: Accepted

Solution code:
S=input()
a=0
for i in range(3):
  if S[i]=="R":
    a+=1
  if S[i]=="S" and a>0:
    break
print(a)

Submission status: Accepted

Solution code:
s=input()

if(s=="RRR"):
    print("3")
elif(s=="RRS" or s=="SRR"):
    print("2")
elif(s=="SSS"):
    print("0")
else:
    print("1")

Submission status: Accepted

Solution code:
S = input()
if S.find('RRR')>=0:
    print(3)
elif S.find('RR')>=0:
    print(2)
elif S.find('R')>=0:
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
N = input()

if N.find("RRR") != -1:
    print(3)
else:
    if N.find("RR") != -1:
        print(2)
    else:
        if N.find("R") != -1:
            print(1)
        else:
            print(0)

Submission status: Accepted

Solution code:
x = input()

if x == "RRR":
    print(3)
elif x == "RRS" or x == "SRR":
    print(2)
elif x == "RSR" or x == "RSS" or x== "SSR" or x=="SRS":
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys,math
try:sys.stdin,sys.stdout=open('input.txt','r'),open('out.txt','w')
except:pass
from sys import stdin,stdout;mod=int(1e9 + 7);from statistics import mode
from collections import *;from math import ceil,floor,inf,factorial,gcd,log2,sqrt,log
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
# print('{:.3f}'.format(1),round(1.123456789,4))
# sys.setrecursionlimit(500000)
def lcm(a,b): return (a*b)//gcd(a,b)
def setbits(n):return bin(n).count('1')
def resetbits(n):return bin(n).count('0')
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r):
    num,den=1,1;r=min(n,n-r)
    for i in range(r):num*=(n-i);den*=(i+1)
    return num//den
def ncr_p(n, r, p):
    num,den=1,1;r=min(r,n-r)
    for i in range(r):num = (num * (n - i)) % p ;den = (den * (i + 1)) % p
    return (num * modinv(den,p)) % p
def isPrime(num) :
    if num<=1:return False
    if num==2 or n==3:return True
    if (num % 2 == 0 or num % 3 == 0) :return False
    m = int(num**0.5)+1
    for i in range(5,m,6):
        if (num % i == 0 or num % (i + 2) == 0) :return False
    return True
def bin_search(arr, low, high, val):
    while low <= high:
        mid = low + (high - low) // 2;
        if arr[mid] == val:return mid
        elif arr[mid] < val:low = mid + 1
        else:high = mid - 1
    return -1
def sumofdigit(num):
    count=0;
    while num : count+=num % 10;num //= 10;
    return count;
def inputmatrix():
    r,c=iia();mat=[0]*r;
    for i in range(r):mat[i]=iia();
    return r,c,mat;
def prefix_sum(n,arr):
    for i in range(1,n):arr[i]+=arr[i-1]
    return arr;
def binomial(n, k):
    if 0 <= k <= n:
        ntok = 1;ktok = 1
        for t in range(1, min(k, n - k) + 1):ntok *= n;ktok *= t;n -= 1
        return ntok // ktok
    else:return 0
def divisors(n):
    res = [];
    for i in range(1,ceil(sqrt(n))+1):
        if n%i == 0:
            if i==n//i:res.append(i)
            else:res.append(i);res.append(n//i)
    return res;
# code start from here-

s=is1()
if s[0]==s[1]==s[2]=='R':
    print(3)
elif s[0]==s[1]=='R' or s[1]==s[2]=='R' :
    print(2)
elif s[0]=='R' or s[1]=='R' or s[2]=='R':
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys
W = input()

ans = 0
if W[:] == "RRR":
    print(3)
    sys.exit(0)
elif W[:2] == "RR" or W[1:] == "RR":
    print(2)
    sys.exit(0)
elif "R" in W:
    print(1)
    sys.exit(0)
print(0)

Submission status: Accepted

Solution code:
w=list(input())

if not "R" in w:
    print(0)
elif not "S" in w:
    print(3)
else:
    if w[1]=="R" and (w[0]=="R" or w[2]=="R"):
        print(2)
    else:
        print(1)

Submission status: Accepted

Solution code:
S = input()

cnt=0

for i in range(3):
    if S[i]=='R':
        cnt+=1
if cnt==0:
    out=0

elif cnt==1:
    out=1
elif cnt==3:
    out=3
else:
    if S[0]=='R' and S[2]=='R':
        out=1
    else:
        out=2
print(out)

Submission status: Accepted

Solution code:
s=input()
if(s=="RRR"):
  n=3
elif(s[1:]=="RR" or s[:2]=="RR"):
  n=2
elif(s=="SSS"):
  n=0
else:
  n=1
print(n)

Submission status: Accepted

Solution code:
S=str(input())

cnt=0
ans=0
for i in range(3):
    if S[i]=='R':
        cnt=cnt+1
        ans=max(ans,cnt)
    else:
        cnt=0

print(ans)

Submission status: Accepted

Solution code:
s=input()

r=[]
l=0

for i in range(len(s)):

    if s[i]=='R':
        l+=1

    else:
         if l!=0:
            r.append(l)
            l=0

if l!=0:
    r.append(l)
if len(r):    
   
   print(max(r))    
else:
    print(0)

Submission status: Accepted

Solution code:
s = list(input())

count = 1

for i in range(len(s)-1):
  if s.count("R") == 0:
    count = 0
  elif s[i] == "R" and s[i+1] == "R":
    count += 1
    
print(count)

Submission status: Accepted

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

s = input()

if s[0]==s[1] and s[1]==s[2]:
	if s[0] == "R":
		print(3)
	else:
		print(0)
elif s[0]==s[1]:
	if s[0]=="R":
		print(2)
	else:
		print(1)
elif s[1]==s[2]:
	if s[1]=="R":
		print(2)
	else:
		print(1)
else:
	if "R" in s:
		print(1)
	else:
		print(0)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
S = input()

if "RRR" == S:
    print(3)
elif "RR" in S:
    print(2)
elif "R" in S:
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
ans = 0
answer = []
S = input()
for s in S:
    if s == "R":
        ans += 1
    else:
        answer.append(ans)
        ans = 0
answer.append(ans)
print(max(answer))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:30:06 2020

@author: divyarth
"""

import sys
import heapq
import math

#sys.setrecursionlimit(100000)
#input=sys.stdin.readline
#print=sys.stdout.write

from collections import deque
from collections import defaultdict
from collections import Counter

modH=int(10**9)+7
I=lambda : list(map(int,input().split(' ')))
def PRINT(lst,sep=' '): print(sep.join(map(str,lst)))

s=input()
stack=[]
mm=0
for i in range(len(s)):
    if s[i]=='R':
        stack.append('R')
    else:
        cnt=0
        while len(stack):
            stack.pop()
            cnt+=1
        mm=max(mm,cnt)        
cnt=0
while len(stack):
    stack.pop()
    cnt+=1
mm=max(mm,cnt)
print(mm)

Submission status: Accepted

Solution code:
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    weather = input()
    if weather == 'RRR':
        return 3
    elif weather == 'SRR':
        return 2
    elif weather == 'RSR':
        return 1
    elif weather == 'RRS':
        return 2
    elif weather == 'SSS':
        return 0
    else:
        return 1


def main():
    print(solve())


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))
#sys.setrecursionlimit(1500)
def dict(a):
    d={} 
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d


def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        l=list(input())
        if l[0]=='R' and l[1]=='R' and l[2]=='R':
            ans=3
            print(ans)
            return
        if (l[0]=='R' and l[1]=='R') or (l[1]=='R' and l[2]=='R'):
            ans=2
            print(ans)
            return
        else:
            ans=0
            for x in range(3):
                if l[x]=='R':
                    ans=1
                    break
            print(ans)
    except: 
        pass
        
M = 998244353
P = 1000000007
Inf=1000000000000000000
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

Submission status: Accepted

Solution code:
s = list(input())
l = []

count = 0
for i in range(3):
    if s[i] == 'R':
        count += 1
    else:
        l.append(count)
        count = 0
l.append(count)

print(max(l))

Submission status: Accepted

Solution code:
s = input()

if "RRR" in s:
    ans = 3
elif "RR" in s:
    ans = 2
elif "R" in s:
    ans = 1
else:
    ans = 0

print(ans)

Submission status: Accepted

Solution code:
s=input()
if s=='RRR':
  print(3)
elif s=='SRR' or s=='RRS':
  print(2)
elif s=='SSS':
  print(0)
else:
  print(1)

Submission status: Accepted

Solution code:
s = input()

if s == 'RRR':
    print(3)
elif s == 'SSS':
    print(0)
elif s == 'RRS' or s == 'SRR':
    print(2)
else:
    print(1)

Submission status: Accepted

Solution code:
s = input()
count = 0
if s == "SSS":
  print(0)
elif s == "RSS" or s == "SRS" or s == "SSR" or s == "RSR":
  print(1)
elif s== "SRR" or s == "RRS":
  print(2)
elif s == "RRR":
  print(3)

Submission status: Accepted

Solution code:
S = input()
count = 0
if S[1]=="R":
  print(S.count("R"))
elif "R" in S:
  print(1)
else:
  print(0)

Submission status: Accepted

Solution code:
import math

s = input()

if s == "RSR" or s == "SRS" or s == "RSS" or s == "SSR":
    print(1)
elif s == "RRS" or s == "SRR":
    print(2)
elif s == "RRR":
    print(3)
else:
    print(0)

Submission status: Accepted

Solution code:
n = list(input())
n_r = len([i for i in n if i == "R"])

if n_r == 2:
  if n[1] == "S":
    print(1)
  else:
    print(2)
else:
  print(n_r)

Submission status: Accepted

Solution code:
s=input()
count=0
count1=0
for i in s:
    if i=='R':
        count+=1
        if count1<count:
            count1=count
    else:
        count=0
print(count1)

Submission status: Accepted

Solution code:
a =input()
if a=="RRR":
    print(3)
elif a == "RRS" or a=="SRR":
    print(2)
elif a == "SSS":
    print(0)
else:
    print(1)

Submission status: Accepted

Solution code:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    S = str(input())

    if S[1] == "S":
        if S[2] =="R" or S[0] =="R":
            print(1)
        else:
            print(0)
    else:
        if S[2] =="R" or S[0] =="R":
            if S[2] =="R" and S[0] =="R":
                print(3)
            else:
                print(2)
        else:
            print(1)

    

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
a = input()

if a == "RRR":
    print(3)
elif a == "RRS" or a == "SRR":
    print(2)
elif a == "SSS":
    print(0)
else:
    print(1)

Submission status: Accepted

Solution code:
import sys
import numpy as np
X = str(input())

d = 0
s = 0
for i in X:
    if i == 'R':
        d += 1
    else:
        if s < d:
            s = d
        d = 0
if s < d:
    s = d

print(s)

Submission status: Accepted

Solution code:
S = input()

cnt = S.count('R')
if cnt == 0:
    print(cnt)
else:
    if cnt == 2:
        if S.count('RR') == 1:
            print(cnt)
        else:
            print(1)
    else:
        print(cnt)

Submission status: Accepted

Solution code:
S = input()
if S == "RRR":
  print(3)
elif "RR" in S:
  print(2)
elif "R" in S:
  print(1)
else:
  print(0)

Submission status: Accepted

Solution code:
l = input()
if(l.count("RRR")==1):
    print(3)
elif(l.count("RR")==1):
    print(2)
elif(l.count("R")>=1):
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
import sys


def resolve(in_):
    S = in_.read().strip().split('S')

    ans = max(len(s) for s in S)
    return ans
    

def main():
    answer = resolve(sys.stdin)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = input()

maxs = 0
ans = []
for a in s:
    if a == 'R':
        maxs += 1
    else:
        ans.append(maxs)
        maxs = 0


ans.append(maxs)
print(max(ans))

Submission status: Accepted

Solution code:
#K = input()
#X = list(map(int, input().split()))
#s = input().split()
S = input()

flag = True
count = 0
if (S[0] == "R"):
    count += 1
else:
    flag = False

if (S[1] == "R"):
    count += 1
    flag = True
else:
    flag = False

if (S[2] == "R"):
    if (flag):
        count += 1
    else:
        count = 1

print(count)

Submission status: Accepted

Solution code:
def resolve():
    s=input()
    if s[0]=="R":
        if s[1]=="R":
            if s[2]=="R":
                print(3)
            else:
                print(2)
        else:
            print(1)
    else:
        if s[1]=="R":
            if s[2]=="R":
                print(2)
            else:
                print(1)
        else:
            if s[2]=="R":
                print(1)
            else:
                print(0)
resolve()

Submission status: Accepted

Solution code:
s = input()
if s[0] == "R" and s[1] == "R" and s[2] == "R":
    print(3)
elif s[1] == "R":
    if s[0] == "R" or s[2] == "R":
        print(2)
    else:
        print(1)
elif s[0] == "R" or s[2] == "R":
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
N=list(input())
if "R" in N:
    if N[1]=="R":
        if N.count("R")==2:
            print(2)
        elif N.count("R")==1:
            print(1)
        else:
            print(3)
    else:
        print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
S = input()
cnt = S.count('R')
if cnt > 1 and S[1] == 'S':
    cnt -= 1
print(cnt)

Submission status: Accepted

Solution code:
S = input()
List = list(S)
res = 0
if List[0] == "R":
  res = 1
for i in range(1,3):
  if List[i-1] == "R" and List[i] == "R":
    res +=1
  elif List[i-1] == "S" and List[i] == "R":
    res = 1
  else:
    pass
print(res)

Submission status: Accepted

Solution code:
S=input()
if S=="RRR":print(3)
elif S[0]=='R' and S[1]=='R':print(2)
elif S[1]=='R' and S[2]=='R':print(2)
elif S[0]=='R' or S[1]=='R' or S[2]=='R':print(1)
else:print(0)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline


def print_ans(S):
    """Test Case
    >>> print_ans("RRS")
    2
    >>> print_ans("SSS")
    0
    >>> print_ans("RSR")
    1
    """
    count = 0
    maximum = 0
    for a in S:
        if a == "R":
            count += 1
        else:
            count = 0
        maximum = max(count, maximum)
    print(maximum)


if __name__ == '__main__':
    S = input().rstrip()
    print_ans(S)

Submission status: Accepted

Solution code:
S = list(str(input()))

if S.count("R") == 3:
    print("3")
elif S.count("R") == 1:
    print("1")
elif S.count("R") == 2:
    if S[1] == "R":
        print("2")
    else:
        print("1")
else:
    print("0")

Submission status: Accepted

Solution code:
S = input()
if S == 'SSS':
    print(0)
elif S.count('R')==1:
    print(1)
elif S.count('R')==2:
    if S == 'RSR':
        print(1)
    else:
        print(2)
else:
    print(3)

Submission status: Accepted

Solution code:
s = input()

ans = 0
tmp = 0
for i in range(3):
    if s[i] == 'R':
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
print(max(ans, tmp))

Submission status: Accepted

Solution code:
i=list(input())
if i[1] == "R":
    print(i.count("R"))
else:
    if i[0] == "R" and i[2] == "R":
        print(1)
    else:
        print(i.count("R"))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str):
    if S == "RRR":
        print(3)
    elif S == "SRR" or S == "RRS":
        print(2)
    elif S.count("R") == 2 or S.count("R") == 1:
        print(1)
    else:
        print(0)
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()

if s == "RRR":
    print(3)
elif s == "RRS" or s == "SRR":
    print(2)
elif s == "RSS" or s == "SRS" or s == "SSR" or s == "RSR":
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
a = str(input())

count = 0
for i in range(3):
  if a[i] == 'R':
    count += 1
  elif count > 0 and a[i] != 'R':
    break

print(str(count))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:30:26 2020

@author: HP
"""


s = input()

if s=="RRR":
    print("3")
elif s=="RRS" or s=="SRR":
    print("2")
elif s=="SSS":
    print("0")
else:
    print("1")

Submission status: Accepted

Solution code:
s = input()
count = 0
m = 0
for c in s:
    if(c == "R"):
        count+=1
if count != 2:
    print(count)
elif s[1] == "S":
    print(1)
else:
    print(2)

Submission status: Accepted

Solution code:
s = input()
if s == "RRR":
    print(3)
elif s == "SRR" or s == "RRS":
    print(2)
elif s == "SSS":
    print(0)
else:
    print(1)

Submission status: Accepted

Solution code:
def main():
    s = input()
    pre = ''
    start = False
    count = 0
    for c in s:
        if not start and c == 'R':
            start = True
            count = 1
        if start and c == 'R' == pre:
            count += 1
        pre = c
    print(count)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())
ans = 0
ls = []
for i in S:
    if i == 'R':
        ans += 1
    else:
        ans = 0
    ls.append(ans)
print(max(ls))

Submission status: Accepted

Solution code:
s = input()
if 'R' in s:
    if 'RR' in s:
        if 'RRR' in s:
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
# coding: utf-8
#import numpy as np
import re
import math
from collections import defaultdict,deque,Counter
from fractions import Fraction
import bisect
import itertools
from itertools import accumulate
from copy import deepcopy
import heapq
import random
import time
import os
import sys
from functools import lru_cache,reduce
readline=sys.stdin.readline
sys.setrecursionlimit(100000)
alp="abcdefghijklmnopqrstuvwxyz"
numbers="0123456789"
mod=int(10**9+7)
inf=int(10**19)
class Set():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(bool)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        if not self.find(x):
            heapq.heappush(self.heap,x)
            self.dic[x]=True
            self.size+=1

    def remove(self,x):
        if self.find(x):
            self.dic[x]=False
            self.size-=1

    def find(self,x):
        return self.dic[x]
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==False:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class multiset():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(int)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        heapq.heappush(self.heap,x)
        self.dic[x]+=1
        self.size+=1

    def remove(self,x):
        if self.dic[x]>0:
            self.dic[x]-=1
            self.size-=1
    
    def count(self,x):
        return self.dic[x]

    def find(self,x):
        return self.dic[x]>0
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==0:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class Edge():
    def __init__(self,x,y,val=1):
        self.x=x
        self.y=y
        self.val=val
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def yn(b):print("yes" if b else "no")
def Yn(b):print("Yes" if b else "No")
def YN(b):print("YES" if b else "NO")
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    return now==a
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n):
    if n==0:return []
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    ret=[]
    for a in range(n+1):
        if(A[a]):ret.append(a)
    return ret
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(b,t,f):return t if b else f
def factorize(n):
    b = 2
    ret=defaultdict(int)
    while b * b <= n:
        while n % b == 0:
            n //= b
            ret[b]+=1
        b+=1
    if n > 1:ret[n]+=1
    return ret
def inputintlist(row=1): 
    if row==1:
        ret=list(map(int,input().split()))
    else:
        ret=[None]*row
        for a in range(row):
            ret[a]=int(input())
    return ret
def inputfloatlist(row=1): 
    if row==1:
        ret=list(map(float,input().split()))
    else:
        ret=[None]*row
        for a in range(row):
            ret[a]=float(input())
    return ret
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def yuukoutomukou(edges):
    ret=deepcopy(edges)
    for edge in edges:
        if not edge.x==edge.y:
            ret.append(Edge(edge.y,edge.x,edge.val))
    return ret
def dijkstra(edges,V,start):
    mincost=[inf]*V
    G=[[] for a in range(V)]
    for edge in edges:
        G[edge.x].append([edge.val,edge.y])
    Q=PriorityQueue()
    Q.put([0,start])#[cost,x]
    while not Q.empty():
        nowcost,nowx=Q.get()
        if mincost[nowx]==inf:
            mincost[nowx]=nowcost
            for cost,y in G[nowx]:
                newcost=nowcost+cost
                Q.put([newcost,y])
    return mincost
def warshallfloyd(edges,V):
    mincost=[[inf for b in range(V)] for a in range(V)]
    for a in range(V):mincost[a][a]=0
    for edge in edges:
        mincost[edge.x][edge.y]=min(mincost[edge.x][edge.y],edge.val)#x→yが複数ある場合のためにmin()する
    for k in range(V):
        for s in range(V):
            for t in range(V):
                if mincost[s][k]==inf or mincost[k][t]==inf:continue
                mincost[s][t]=min(mincost[s][t],mincost[s][k]+mincost[k][t])
    return mincost
def bellemanford(edges,V,start):
    mincost=[inf]*V
    mincost[start]=0
    for _ in range(V):
        for edge in edges:
            if mincost[edge.x]==inf:continue
            mincost[edge.y]=min(mincost[edge.y],mincost[edge.x]+edge.val)
    return mincost
def getmd(x1,y1,x2,y2):return abs(x1-x2)+abs(y1-y2)
def geted(x1,y1,x2,y2):return math.sqrt((x1-x2)**2+(y1-y2)**2)
class fordfulkerson():
    def __init__(self,edges,V,s,t):
        self.V=V
        self.used=[False]*V
        self.G=[[] for a in range(V)]
        self.s=s
        self.t=t
        for edge in edges:
            self.G[edge.x].append({"x":edge.x,"y":edge.y,"cap":edge.val,"rev":len(self.G[edge.y])})
            self.G[edge.y].append({"x":edge.y,"y":edge.x,"cap":0,"rev":len(self.G[edge.x])-1})
    def dfs(self,v,t,f=inf):
        if v==t:return f
        self.used[v]=True
        for a in range(len(self.G[v])):
            x=self.G[v][a]["x"]
            y=self.G[v][a]["y"]
            cap=self.G[v][a]["cap"]
            rev=self.G[y][self.G[x][a]["rev"]]
            if self.used[y] or cap==0:continue
            f2=self.dfs(y,t,min(f,cap))
            if f2>0:
                self.G[v][a]["cap"]-=f2
                rev["cap"]+=f2
                return f2
        return 0
    def maxflow(self):
        flow=0
        while True:
            self.used=[False]*V
            zouka=self.dfs(self.s,self.t)
            if zouka==0:break
            flow+=zouka
        return flow
def zipsort(*args):
    ziplist=sorted(zip(*args))
    for a in range(len(args)):
        for b in range(len(ziplist)):
            args[a][b]=ziplist[b][a]
def zipreverse(*args):
    ziplist=list(zip(*args))
    rev=[]
    for a in range(len(ziplist)-1,-1,-1):
        rev.append(ziplist[a])
    for a in range(len(args)):
        for b in range(len(rev)):
            args[a][b]=rev[b][a]

def to10(A):
    ret=0
    for a in range(len(A)-1,-1,-1):
        ret+=X[a]*2**(N-1-a)
    return ret
######################################################################################################
s=input()
ren=0
ans=0
for a in range(len(s)):
    if s[a]=="R":
        ren+=1
    else:
        ren=0
    ans=max(ans,ren)
print(ans)

Submission status: Accepted

Solution code:
s = str(input())
if s == "RRR":
    print(3)
elif s == "RRS" or s == "SRR":
    print(2)
elif s == "SRS" or s == "SSR" or s == "RSS" or s == "RSR":
    print(1)
else:
    print(0)