s = input()

r = ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"]
ra = [2,3,1,2,1,1,0,1]
for i in range(8):
    if r[i] == s:
        print(ra[i]) s = input() s input() input r = ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"] r ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"] "RRS" "RRR" "RSR" "SRR" "SSR" "RSS" "SSS" "SRS" ra = [2,3,1,2,1,1,0,1] ra [2,3,1,2,1,1,0,1] 2 3 1 2 1 1 0 1 for i in range(8):
    if r[i] == s:
        print(ra[i]) i range(8) range 8 if r[i] == s:
        print(ra[i]) r[i] == s r[i] r i s print(ra[i]) print ra[i] ra i r = ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"] ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"] r s = input() input() s ra = [2,3,1,2,1,1,0,1] [2,3,1,2,1,1,0,1] ra
s = input()

r = ["RRS","RRR","RSR","SRR","SSR","RSS","SSS","SRS"]
ra = [2,3,1,2,1,1,0,1]
for i in range(8):
    if r[i] == s:
        print(ra[i])