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:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

S = In.str()

if S[0] == "R" and S[1] == "R" and S[2] == "R":
    Out.int(3)
elif S[0] == "R" and S[1] == "R":
    Out.int(2)
elif S[2] == "R" and S[1] == "R":
    Out.int(2)
elif "R" in S:
    Out.int(1)
else:
    Out.int(0)

######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Accepted

Solution code:
from collections import Counter
def main():
    S = input()
    C = Counter(S)
    if C["R"] == 3:
        print(3)
    elif C["R"] == 2:
        if S[1] == "S":
            print(1)
        else:
            print(2)
    elif C["R"] == 1:
        print(1)
    else:
        print(0)
        
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
ans = 0
count = 0
for char in S:
    if char == 'S':
        ans = max(ans, count)
        count = 0
    else:
        count+=1
ans = max(ans, count)
print(ans)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))


cnt = 0
mx = 0
s = [_ for _ in input()]
for si in s:
  if si == 'R':
    cnt +=1
    mx = max(mx, cnt)
  else:
    mx = max(mx, cnt)
    cnt =0

print(mx)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = input().strip()

if 'R' not in s:
    print(0)
    sys.exit(0)
else:
    if s == 'RRR':
        print(3)
        sys.exit(0)
    elif 'RR' in s:
        print(2)
        sys.exit(0)
    else:
        print(1)
        sys.exit(0)

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

print(ans)

Submission status: Accepted

Solution code:
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:
def main(S):
    if S[0] == 'R':
        if S[1] ==  'R':
            if S[2] == 'R':
                return 3
            else:
                return 2
        else:
            return 1
    else:
        if S[1] == 'R':
            if S[2] == 'R':
                return 2
            else:
                return 1
        else:
            if S[2] == 'R':
                return 1
            else:
                return 0

S = input()
print(main(S))

Submission status: Accepted

Solution code:
s = input()
n = 0
maximum = 0
for i in range(len(s)):
    if s[i] == "R":
        n+=1
        maximum = max(n,maximum)
    else:n=0
print(maximum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:

s = input()

if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
days = input()



result = []

num = 0
for d in days:
  if d == 'R':
    num += 1
  else:
    result.append(num)
    num = 0
result.append(num)

print(max(result))

Submission status: Accepted

Solution code:
txt=input()
ans=[0]
for  t in txt:
    if t=="R":
        ans[-1]+=1
    else:
        ans.append(0)
print(max(ans))

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    ans = 0
    if "R" in S:
        ans += 1

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




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# import numpy as np
# import collections
# import math


S=input()
#int(input())
#map(int, input().split())
#list(map(int, input().split()))

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()
count = 0
for i in range(3):
    if s[i] == "R":
        count += 1
    else:
        if count != 0:
            break
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
S = list(input())[:-1]
if S[0] == "R" and S[1] == "R" and S[2] == "R":
    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" and S[1] != "R" and S[2] != "R":
    print(0)
else:
    print(1)

Submission status: Accepted

Solution code:
s=input()

if 'RRR' in s:
    a=3
elif 'RR' in s:
    a=2
elif 'R'in s:
    a=1
else:
    a=0

print(a)

Submission status: Accepted

Solution code:
s = input()


if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'R' in s:
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
S=input()

if S=="RSR":
  print(1)
  exit()
  
S=S.replace("S","")

print(len(S))

Submission status: Accepted

Solution code:
S=input()

ans=0

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

if ans==2 and S[1]=="S":
    ans=1

print(ans)

Submission status: Accepted

Solution code:
def main():
    s = input()
    if s[0]=='R' and s[1]=='R' and s[2]=='R':
        print(3)
    elif (s[0]=='R' and s[1]=='R') or (s[1]=='R' and s[2]=='R'):
        print(2)
    elif 'R' in s:
        print(1)
    else:
        print(0)
   
if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
if s in ["SSS"] :
    print(0)
elif s in ["RSS", "SRS", "SSR", "RSR"] :
    print(1)
elif s in ["RRS", "SRR"] :
    print(2)
else :
    print(3)

Submission status: Accepted

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

if S.count("RRR") > 0:
    print(3)
elif S.count("RR") > 0:
    print(2)
elif S.count("R") > 0:
    print(1)
else:
    print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if s[1] != 'R':
    print(1 if 'R' in s else '0')
else:
    count = 0
    for c in s:
        if c == 'R':
            count += 1
    print(count)

Submission status: Accepted

Solution code:
w = input()

ans = w.count('R')

if ans == 2 and w[1] == 'S':
  ans -= 1
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = str(input())

if a.count("RRR") >= 1:
    print(3)
elif a.count("RR") >= 1:
    print(2)
elif a.count("R") >= 1:
    print(1)
else:
    print(0)

Submission status: Accepted

Solution code:
s = input()
rainy = s.count("R")
if rainy <= 1 or rainy == 3:
  print(rainy)
elif s[1] == "S":
  print("1")
else:
  print("2")

Submission status: Accepted

Solution code:
S = input()
if S == 'SSS':
    print(0)
    exit(0)
ans = 1
for i in range(1, 3):
    if S[i] == 'R' and S[i - 1] == 'R':
        ans += 1
print(ans)

Submission status: Accepted

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

S = input().rstrip()

c = S.count("R")

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

Submission status: Accepted

Solution code:
s = input()
flag = False
ans = 0
for i in s:
    if i == "R" and flag:
        ans += 1
    elif i == "R":
        ans = 1
        flag = True
    else:
        flag = False
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

tmp = 0
ans = 0

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

ans = max(ans,tmp)

print(ans)

Submission status: Accepted

Solution code:
def main():
    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)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
cnt = 0
ans = 0
S = input()
S += "S"
for s in S:
    if s == "S":
        ans = max(ans, cnt)
        cnt = 0
    else:
        cnt += 1
print(ans)

Submission status: Accepted

Solution code:
s = input()
r = s.count('R')

if r == 2:
    if s[1] == 'R':
        print(2)
    else:
        print(1)
else:
    print(r)

Submission status: Accepted

Solution code:
S=input()

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

Submission status: Accepted

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = str(input())
ans = 0
if 'R' in S:
    ans = 1
    if 'RR' in S:
        ans = 2
        if 'RRR' in S:
            ans = 3
print(ans)

Submission status: Accepted

Solution code:
S = input()
a = S.find("RRR")
b = S.find("RR")
c = S.find("R")
if a != -1:
    print(3)
elif b != -1:
    print(2)
elif c != -1:
    print(1)
else:
    print(0)

Submission status: Accepted

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