AtCoder Beginner Contest 175 - Rainy Season

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-----
RRS

-----Sample Output-----
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.

Difficulty: EASY

Starter code:

Solutions:
s = input()
print(s.count('R') - 1 if s == 'RSR' else s.count('R'))


s = input()
for i in range(4)[::-1]:
	if 'R' * i in s:
		print(i)
		break


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


input_data = input()
counts = []
count = 0
for i in range(3):
	if input_data[i] == 'R':
		count += 1
	else:
		counts.append(count)
		count = 0
counts.append(count)
counti = max(counts)
print(counti)


a = [0]
for i in input():
	if i == 'R':
		a += [a[-1] + 1]
	else:
		a += [0]
print(max(a))


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)
elif S == 'SSS':
	print(0)


S = list(input())
count = S.count('R')
if S == ['R', 'S', 'R']:
	count = 1
print(count)


s = input()
print(('R' in s) + ('RR' in s) + ('RRR' in s))


S = input()
if S == 'RSR':
	print(1)
	exit()
S = S.replace('S', '')
print(len(S))


S = input().split('S')
ans = 0
for i in S:
	ans = max(ans, len(i))
print(ans)


s = input()
if 'R' not in s:
	print(0)
elif s[1] == 'S':
	print(1)
else:
	print(s.count('R'))


s = input().strip().split('S')
print(len(max(s, key=len)))


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


S = input()
r = S.count('R')
if S == 'RSR':
	r -= 1
print(r)


S = input()
R = S.count('R')
print('1' if R == 2 and S[1] == 'S' else R)


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


S = input()
for i in range(3, 0, -1):
	if 'R' * i in S:
		print(i)
		break
else:
	print(0)


s = input().split('S')
a = map(len, s)
print(max(a))


s = input()
rain = s.split('S')
lens = map(len, rain)
print(max(lens))


s = input()
ans = 0
for i in range(1, 4):
	if 'R' * i in s:
		ans = i
print(ans)


s = input()
print(max([len(elem) for elem in s.split('S')]))


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


s = input()
if s == 'SSS':
	print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS' or (s == 'RSR'):
	print(1)
if s == 'SRR' or s == 'RRS':
	print(2)
if s == 'RRR':
	print(3)


S = input()
for i in range(4):
	if 'R' * i in S:
		ans = i
print(ans)


s = input().split('S')
m = 0
for i in s:
	if len(i) > m:
		m = len(i)
print(m)


s = input()
n = s.count('R')
if s == 'RSR':
	n = 1
print(n)


inp = input()
print(max(map(len, inp.split('S'))))


s = input()
a = s.count('R')
if a == 2 and s[1] != 'R':
	a = 1
print(a)


S = input()
s = S.count('R')
if s == 2 and S[0] == 'R' and (S[2] == 'R'):
	s -= 1
print(s)


from sys import stdin
S = stdin.readline().rstrip()
if S == 'RSR':
	ans = 1
else:
	ans = S.count('R')
print(ans)


s = input().split('S')
ans = 0
for i in s:
	if len(i) > ans:
		ans = len(i)
print(ans)


s = input()
ans = s.count('R')
if s == 'RSR':
	ans = 1
print(ans)


str = input()
cnt = str.count('R')
if cnt == 3:
	print(3)
elif cnt == 2:
	if str[0] == str[2]:
		print(1)
	else:
		print(2)
elif cnt == 1:
	print(1)
else:
	print(0)


s = input()
if s == 'RRR':
	print(3)
elif s == 'RSR':
	print(1)
else:
	print(s.count('R'))


N = input()
ans = 0
for i in range(1, 4):
	p = 'R' * i
	if p in N:
		ans = i
print(ans)


n = input()
a = n.count('R')
if n[1] == 'S' and a == 2:
	a = 1
print(a)


def main():
	S = input()
	flag = 0
	cnt = 0
	maxC = 0
	for i in range(len(S)):
		if S[i] == 'S':
			flag = 0
			continue
		elif flag == 0:
			cnt = 1
			flag = 1
		else:
			cnt += 1
		if maxC < cnt:
			maxC = cnt
	print(maxC)

def __starting_point():
	main()
__starting_point()


s = input()
w_l = s.split('S')
print(max([m for m in map(len, w_l)]))


S = input()
a = S.count('R')
if S == 'RSR':
	print(1)
	exit()
print(a)


def main():
	s = input()
	cnt = s.count('R')
	if s[1] == 'R':
		print(cnt)
	else:
		print(min(cnt, 1))
	return

def __starting_point():
	main()
__starting_point()


s = input()
c = s.count('R')
if c == 2 and s[1] == 'S':
	c = 1
print(c)


s = input()
for i in range(3, -1, -1):
	if 'R' * i in s:
		print(i)
		break


ss = str(input())
a = int(ss.count('R'))
if ss == 'RSR':
	a = 1
print(a)


S = input()
s = 0
t = 0
for i in range(len(S)):
	if S[i] == 'R':
		s = s + 1
		if s > t:
			t = s
	else:
		s = 0
print(t)


s = input()
c = 0
r = 0
for i in s:
	if i != 'R':
		c = 0
	else:
		c += 1
		r = max(r, c)
print(r)


N = input()
s = list(N)
if s[0] == s[1] == s[2] == 'R':
	print(3)
elif s[0] == s[1] == 'R' and s[2] == 'S' or (s[2] == s[1] == 'R' and s[0] == 'S'):
	print(2)
elif s[0] == s[1] == s[2] == 'S':
	print(0)
else:
	print(1)


S = input()
for i in range(4)[::-1]:
	if 'R' * i in S:
		print(i)
		exit()


n = input()
if n == 'RSR':
	print(1)
else:
	print(n.count('R'))


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


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


s = input()
c = 0
for i in range(3):
	if s[i] == 'R':
		c += 1
if s == 'RSR':
	print(1)
else:
	print(c)


s = input()
s = s.split('S')
print(len(max(s)))


a = input()
k = 0
for i in range(3):
	if a[i] == 'R':
		k = k + 1
if a == 'RSR':
	k = 1
print(k)


S = input()
if S[0:3] == 'RRR':
	print(3)
elif S[0:2] == 'RR' or S[1:3] == 'RR':
	print(2)
elif S == 'SSS':
	print(0)
else:
	print(1)


l = input()
for i in range(4):
	if 'R' * i in l:
		ans = i
print(ans)


S = input()
print(S.count('R') if S != 'RSR' else 1)


S = input().strip().split('S')
S.sort()
print(len(S[-1]))


s = input()
ans = s.count('R')
if ans == 2 and s == 'RSR':
	ans = 1
print(ans)


s = input()
mx = 0
for i in range(1, 4):
	if s.count('R' * i):
		mx = i
print(mx)


A = input()
B = A.count('R')
if A == 'RSR':
	print(1)
else:
	print(B)


s = input()
ans = 0
if 'R' in s:
	if s[0] == s[1] or s[1] == s[2]:
		ans = s.count('R')
	else:
		ans += 1
print(ans)


str = input()
flg = False
count = 0
max = 0
for s in str:
	if s == 'R':
		if flg == True:
			count += 1
			if max < count:
				max = count
		else:
			flg = True
			count += 1
			if max < count:
				max = count
	else:
		flg = False
		count = 0
print(max)


def main():
	S = input()
	if S == 'RRR':
		ans = 3
	elif S in ['RRS', 'SRR']:
		ans = 2
	elif S == 'SSS':
		ans = 0
	else:
		ans = 1
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


S = list(input())
a = S.count('R')
ans = a
if S == ['R', 'S', 'R']:
	ans = 1
print(ans)


S = input()
S_list = list(S)
if S[0] != S[1] and S[1] != S[2]:
	print(1)
else:
	print(S_list.count('R'))


S = input().strip()
print(max((len(s) for s in S.split('S'))))


s = input()
for i in range(3, 0, -1):
	if 'R' * i in s:
		print(i)
		exit()
print(0)


s = input()

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


S = input().strip()
print(max([len(i) for i in S.split('S')]))


s = input().rstrip()
print(max(map(len, s.split('S'))))


p = {'RRR': 3, 'RRS': 2, 'SRR': 2, 'RSR': 1, 'SSR': 1, 'RSS': 1, 'SSS': 0, 'SRS': 1}
print(p[input()])


import re
s = input()
arr = re.split('S+', s)
print(max([len(e) for e in arr]))


s = input()
w = {'SSS': 0, 'SSR': 1, 'SRS': 1, 'SRR': 2, 'RRR': 3, 'RSR': 1, 'RRS': 2, 'RSS': 1}
print(w[s])


a = lambda x: x.count('R') if x.count('R') in {0, 1, 3} else 1 if x == 'RSR' else 2
print(a(input()))


s = sorted(input().split('S'), reverse=True)
print(len(s[0]))


s = input()
count = 0
ans = 0
for i in s:
	if i == 'R':
		count += 1
	else:
		count = 0
	ans = max(ans, count)
print(ans)


s = input().split('S')
max = 0
for t in s:
	if max < len(t):
		max = len(t)
print(max)


S = input()
if S[0] == S[1] == S[2] == 'R':
	print(3)
elif S[1] == S[2] == 'R' or S[1] == S[0] == 'R':
	print(2)
elif 'R' in set(list(S)):
	print(1)
else:
	print(0)


S = input()
cnt = 0
ans = 0
for i in range(len(S)):
	if S[i] == 'R':
		cnt = cnt + 1
		if ans < cnt:
			ans = cnt
	else:
		cnt = 0
print(ans)


s = input()
cnt = s.count('R')
if cnt == 2 and s[1] == 'S':
	cnt -= 1
print(cnt)


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


s = input()
if s.count('R') == 2 and s[1] != 'R':
	print(1)
else:
	print(s.count('R'))


def main():
	S = input()
	r_max = 0
	r = 0
	for i in range(len(S)):
		if S[i] == 'R':
			r += 1
			r_max = max([r, r_max])
		else:
			r = 0
	print(r_max)
main()


S = input()
if S == 'RSR':
	ans = 1
else:
	S = list(S)
	ans = S.count('R')
print(ans)


S = input()
s = list(S)
if S == 'RSR':
	print(1)
else:
	print(s.count('R'))


s = input()
ans = 0
x = s.count('R')
if s[1] == 'S':
	if x == 2:
		x -= 1
print(x)


s = input()
for i in range(5):
	if 'R' * i not in s:
		print(i - 1)
		break


s = input().split('S')
ans = max([len(x) for x in s])
print(ans)


S = input()
sum = S.count('R')
if sum == 2 and S[1] == 'S':
	sum -= 1
print(sum)


S = list(input().split('S'))
print(max((len(s) for s in S)))


n = input()
count = 0
if 'R' in n:
	if n[0] == n[1] or n[1] == n[2]:
		count = n.count('R')
	else:
		count += 1
print(count)


x = max(map(len, input().split('S')))
print(x)


s = input()
sn = s.strip('S')
if 'S' in sn:
	print(1)
else:
	print(len(sn))


s = input()
c = s.count('R')
if c == 2 and s == 'RSR':
	c = 1
print(c)


ss = input().split('S')
m = 0
for li in ss:
	m = max(m, len(li))
print(m)


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


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


i = input()
m = 0
if 'R' in i:
	m += 1
if 'RR' in i:
	m += 1
if 'RRR' in i:
	m += 1
print(m)


import collections
S = input()
RainyDay = S.count('R')
if RainyDay == 2 and S[1] == 'S':
	RainyDay = 1
print(RainyDay)


S = input()
c = S.count('R')
if 'RSR' in S:
	print(1)
else:
	print(c)


print(max([len(x) for x in input().split('S')]))


s = input()
a0 = ['SSS']
a1 = ['RSS', 'SRS', 'SSR', 'RSR']
a2 = ['RRS', 'SRR']
a3 = ['RRR']
if s in a0:
	ans = 0
elif s in a1:
	ans = 1
elif s in a2:
	ans = 2
else:
	ans = 3
print(ans)


x = str(input())
x = x.replace('RRR', 'k')
if 'k' in x:
	print(3)
else:
	x = x.replace('RR', 'k')
	if 'k' in x:
		print(2)
	else:
		x = x.replace('R', 'k')
		if 'k' in x:
			print(1)
		else:
			print(0)


s = 0
wealth = input()
for i in wealth:
	if i == 'R':
		s = s + 1
	if s >= 2 and wealth[1] == 'S':
		s = 1
print(int(s))


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
import sys
import math
import collections
s = input()
cnt = 0
pre = 1
ma = 0
for i in range(3):
	if s[i] == 'R' and pre == 1:
		cnt += 1
	elif s[i] == 'R' and pre == 0:
		pre = 1
		cnt = 1
	else:
		cnt = 0
		pre = 0
	ma = max(cnt, ma)
print(ma)


n = input()
c = 0
mx = 0
for i in n:
	if i == 'S':
		c = 0
	else:
		c += 1
	if mx < c:
		mx = c
print(mx)


S = input()
ans = 0
if S == 'RSR':
	ans = 1
else:
	ans = S.count('R')
print(ans)


s = input()
(l, r) = [False, False]
if s[0] == s[1] and s[0] == 'R':
	l = True
if s[1] == s[2] and s[1] == 'R':
	r = True
if l and r:
	print(3)
elif l or r:
	print(2)
elif s[0] == 'R' or s[1] == 'R' or s[2] == 'R':
	print(1)
else:
	print(0)


t = input()
n = list(t)
if n[1] == 'S':
	if n[0] == 'S':
		if n[2] == 'R':
			print(1)
		else:
			print(0)
	else:
		print(1)
elif n[0] == 'S':
	if n[2] == 'R':
		print(2)
	else:
		print(1)
elif n[2] == 'R':
	print(3)
else:
	print(2)


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(rs())

def rs_():
	return [_ for _ in rs().split()]

def ri_():
	return [int(_) for _ in rs().split()]
s = rs()
if s == 'RRR':
	a = 3
elif s[:2] == 'RR' or s[1:] == 'RR':
	a = 2
elif s == 'SSS':
	a = 0
else:
	a = 1
print(a)


print(max([len(v) for v in input().split('S')]))


S = input().strip()
f = S.count('R')
if S == 'RSR':
	f = 1
print(f)


s = str(input())
c = s.count('R')
if c >= 1 and s[1] == 'S':
	print(1)
else:
	print(c)


import sys
S = input()
count = 0
ans = 0
for i in range(len(S)):
	if S[i] == 'R':
		count += 1
	else:
		count = 0
	ans = max(ans, count)
print(ans)


S = input()
n_S = len(S)
state_r = 0
ma = 0
for i in range(n_S):
	if S[i] == 'R':
		state_r += 1
	else:
		state_r = 0
	ma = max(ma, state_r)
print(ma)


str = input()
val = str.count('R')
if str[1] != 'R' and val != 0:
	print(1)
else:
	print(val)


s = input()
cnt = s.count('R')
if s[1] == 'R':
	print(cnt)
else:
	print(min(cnt, 1))


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


s = input()
no_r = s.count('R')
if no_r != 2 or s[1] == 'R':
	print(no_r)
else:
	print(1)


s = input()
j = 0
ren = 0
for num in range(3):
	if s[num] == 'R':
		if ren == 1:
			j += 1
		else:
			j = 1
		ren = 1
	else:
		ren = 0
print(j)


s = input()
c = s.count('R')
if s == 'RSR':
	c -= 1
print(c)


a = input().split('S')
cnt = 0
for i in a:
	cnt = max(cnt, len(i))
print(cnt)


S = input()
n = S.count('R')
if S[1] == 'R':
	print(n)
elif n >= 1:
	print(1)
else:
	print(n)


a = max(input().split('S'))
print(len(a))


S = input()
for i in range(3, -1, -1):
	if 'R' * i in S:
		print(i)
		exit()


s = input()
S = s.split('S')
print(max([len(i) for i in S]))


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


x = input()
x = list(x)
i = 0
ans = 0
out = ans
while i != len(x):
	if i == 0:
		if x[i] == 'R':
			ans = 1
			out = ans
	elif x[i] == x[i - 1]:
		if x[i] == 'R':
			ans += 1
			out = max(ans, out)
		else:
			ans = 0
	elif x[i] == 'R':
		ans = 1
		out = max(ans, out)
	else:
		ans = 0
	i += 1
print(out)


S = input().rstrip()
if S[1] == 'S':
	print(min(1, S.count('R')))
else:
	print(S.count('R'))


A = input()
count = 0
ma = 0
for i in A:
	if i == 'R':
		count += 1
	else:
		count = 0
	if count > ma:
		ma = count
print(ma)


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


s = input()
s = list(s)
s_c = s.count('R')
if s[1] == 'S' and s_c == 2:
	s_c = 1
print(s_c)


a = input()
if a == 'RSR':
	print(1)
else:
	print(a.count('R'))


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


s = input()
p = 0
for i in s:
	if i == 'R':
		p += 1
	if i == 'S' and p > 0:
		break
print(p)


s = input()
print(s.count('R') - (s == 'RSR'))


S = input().split('S')
S_len = [len(S_each) for S_each in S]
print(max(S_len))


S = input()
print(max((i for i in range(4) if S.count('R' * i))))


n = input()
print(3 if n == 'RRR' else 2 if 'RR' in n else 1 if 'R' in n else 0)


s = str(input())
p = s[0] == 'R'
q = s[1] == 'R'
r = s[2] == 'R'
if p and q and r:
	print(3)
elif p and q or (q and r):
	print(2)
elif p and r or p or q or r:
	print(1)
else:
	print(0)


S = input()
count = 0
L = []
for i in range(len(S)):
	if S[i] == 'R':
		count += 1
		L.append(count)
	else:
		count = 0
		L.append(count)
print(max(L))


s = input()
if s.count('R') == 2:
	print(s.count('RR') + 1)
else:
	print(s.count('R'))


S = input()
print(('R' in S) + ('RR' in S) + ('RRR' in S))


S = input()
m = 0
b = 0
for s in S:
	if s == 'R':
		b += 1
		m = max(m, b)
	else:
		b = 0
print(m)


def main():
	s = input().split('S')
	x = max(map(len, s))
	print(x)
main()


s = list(input())
count = 0
maximum = 0
while s:
	if s.pop() == 'R':
		count += 1
	else:
		maximum = max(maximum, count)
		count = 0
print(max(count, maximum))


s = list(input())
num = sum([i == 'R' for i in s])
if num == 2:
	if s[1] != 'R':
		num = 1
print(num)


S = input()
cnt = 0
if S[0] == 'R':
	cnt += 1
	if S[1] == 'R':
		cnt += 1
		if S[2] == 'R':
			cnt += 1
		else:
			pass
elif S[1] == 'R':
	cnt += 1
	if S[2] == 'R':
		cnt += 1
	else:
		pass
elif S[2] == 'R':
	cnt += 1
print(cnt)


S = input()
l = S.split('S')
print(max([len(i) for i in l]))


C = input()
print(len(max(C.split('S'))))


(r, s) = (0, input())
for l in s:
	if l == 'S' and r > 0:
		break
	r += 1 if l == 'R' else 0
print(r)


s = list(input())
count = 0
ans = s.count('R')
if s[1] == 'S' and ans == 2:
	print(1)
else:
	print(ans)


import re
s = input()
print(max(map(len, re.split('S', s))))


S = input()
print(max((n * (n * 'R' in S) for n in [1, 2, 3])))


print(max([len(t) for t in input().split('S')]))


l = input().split('S')
out = 0
for i in l:
	if len(i) > out:
		out = len(i)
print(out)


from collections import Counter
s = input()
c = 0
p = 0
cd = 0
for i in range(len(s)):
	if s[i] == 'R' and (p == 0 or c != 0):
		c += 1
		p = 1
	else:
		cd = max(cd, c)
		c = 0
print(max(cd, c))


S = input()
arr = S.split('S')
brr = [len(arr[i]) for i in range(len(arr))]
print(max(brr))


S = input()
ans = S.count('R')
if S == 'RSR':
	ans = 1
print(ans)


S = input()
ans = 0
if S == 'SSS':
	ans = 0
elif S == 'SSR':
	ans = 1
elif S == 'SRS':
	ans = 1
elif S == 'RSS':
	ans = 1
elif S == 'SRR':
	ans = 2
elif S == 'RSR':
	ans = 1
elif S == 'RRS':
	ans = 2
else:
	ans = 3
print(ans)


n = input().split('S')
print(len(sorted(n, key=len, reverse=True)[0]))


def main():
	s = input()
	cnt = s.count('R')
	if cnt == 2 and s[1] != 'R':
		print('1')
	else:
		print(cnt)

def __starting_point():
	main()
__starting_point()


s = input()
a = 0
for i in s:
	if i == 'R':
		a += 1
if s == 'RSR':
	a = 1
print(a)


s = input()
a = s.count('R')
print(1 if a == 2 and s[1] == 'S' else a)


N = input()
if N == 'RSR':
	print(1)
else:
	print(N.count('R'))


S = list(input())
ans = S.count('R')
if S[1] != 'R' and ans == 2:
	ans -= 1
print(ans)


S = str(input())
if S[0] == 'R' and S[1] == 'S':
	print(1)
else:
	print(S.count('R'))


S = input()
(d1, d2, d3) = (0, 0, 0)
if S[0] == 'R':
	d1 = 1
if S[1] == 'R':
	d2 = 1
if S[2] == 'R':
	d3 = 1
print(d2 and d1 + d2 + d3 or (not d2 and (d1 or d3)))


S = input()
if S == 'RSR':
	print(1)
else:
	print(len(S.replace('S', '')))


S = input()
c = 0
r = 'R'
while r in S:
	c += 1
	r += 'R'
print(c)


s = input()
a = s[0]
b = s[1]
c = s[2]
if a == 'S' and b == 'S' and (c == 'S'):
	print('0')
elif a != 'S' and b == 'S' and (c == 'S') or (a == 'S' and b == 'S' and (c != 'S')) or (a == 'S' and b != 'S' and (c == 'S')) or (a != 'S' and b == 'S' and (c != 'S')):
	print('1')
elif a != 'S' and b != 'S' and (c == 'S') or (a == 'S' and b != 'S' and (c != 'S')):
	print('2')
else:
	print('3')


s = input()
if s == 'RSR':
	print(1)
	exit()
print(s.count('R'))


n = input()
renzoku = 0
ans = 0
for i in n:
	if i == 'R':
		renzoku += 1
		ans = max(renzoku, ans)
	else:
		renzoku = 0
print(ans)


s = input()
for i in [3, 2, 1, 0]:
	if 'R' * i in s:
		print(i)
		break


a = input()
b = a.split('S')
ans = 0
for i in b:
	if len(i) > ans:
		ans = len(i)
print(ans)


s = input()
c = s.count('R')
print(c if c != 2 else 2 if s[1] == 'R' else 1)


print(max(map(len, ''.join(map(lambda x: '1' if x == 'S' else '0', input())).split('1'))))


s = input()
if s[1] == 'S':
	print(min(s.count('R'), 1))
else:
	print(s.count('R'))


s = input()
count = 0
for i in range(3):
	if s[i] == 'R':
		if count == 0:
			count += 1
		elif s[i - 1] == 'R':
			count += 1
print(count)


S = input()
r = S.count('R')
if S[1] == 'S' and r == 2:
	r = 1
print(r)


x = input()
t = x.count('R')
if t != 3 and x[0] == x[2] and (x[0] == 'R'):
	t -= 1
print(t)


S = input()
c = 0
ans = 0
for i in list(S):
	if i == 'S':
		c = 0
	else:
		c += 1
	ans = max(ans, c)
print(ans)


s = input()
print(sum(('R' * i in s for i in range(1, 4))))


w = input()
if w == 'RSR':
	print(1)
else:
	print(w.count('R'))


S = str(input())
ans = 0
if S[0] == 'R':
	ans += 1
	if S[1] == 'R':
		ans += 1
		if S[2] == 'R':
			ans += 1
elif S[0] != 'R' and S[1] == 'R':
	ans += 1
	if S[2] == 'R':
		ans += 1
elif S[0] != 'R' and S[1] != 'R' and (S[2] == 'R'):
	ans += 1
elif S[0] == S[1] == S[2] != 'R':
	ans = 0
print(ans)


S = input()
Sl = S.split('S')
maxi = 0
for s in Sl:
	maxi = max(maxi, len(s))
print(maxi)