s = input("")
Scnt = 0
Smem = 0

for i in range(len(s)):
    if s[i] == "S":
        Scnt += 1
        Smem = i

if Scnt == 3:
    print(0)
elif Scnt == 2:
    print(1)
elif Scnt == 0:
    print(3)
elif Scnt == 1 and Smem == 1:
    print(1)
elif Scnt == 1 and Smem != 1:
    print(2) s = input("") s input("") input "" Scnt = 0 Scnt 0 Smem = 0 Smem 0 for i in range(len(s)):
    if s[i] == "S":
        Scnt += 1
        Smem = i i range(len(s)) range len(s) len s if s[i] == "S":
        Scnt += 1
        Smem = i s[i] == "S" s[i] s i "S" Scnt += 1 Scnt 1 Smem = i Smem i if Scnt == 3:
    print(0)
elif Scnt == 2:
    print(1)
elif Scnt == 0:
    print(3)
elif Scnt == 1 and Smem == 1:
    print(1)
elif Scnt == 1 and Smem != 1:
    print(2) Scnt == 3 Scnt 3 print(0) print 0 elif Scnt == 2:
    print(1) Scnt == 2 Scnt 2 print(1) print 1 elif Scnt == 0:
    print(3) Scnt == 0 Scnt 0 print(3) print 3 elif Scnt == 1 and Smem == 1:
    print(1) Scnt == 1 and Smem == 1 Scnt == 1 Scnt 1 Smem == 1 Smem 1 print(1) print 1 elif Scnt == 1 and Smem != 1:
    print(2) Scnt == 1 and Smem != 1 Scnt == 1 Scnt 1 Smem != 1 Smem 1 print(2) print 2 Scnt = 0 0 Scnt Smem = 0 0 Smem Scnt += 1 1 Scnt s = input("") input("") s Smem = i i Smem
s = input("")
Scnt = 0
Smem = 0

for i in range(len(s)):
    if s[i] == "S":
        Scnt += 1
        Smem = i

if Scnt == 3:
    print(0)
elif Scnt == 2:
    print(1)
elif Scnt == 0:
    print(3)
elif Scnt == 1 and Smem == 1:
    print(1)
elif Scnt == 1 and Smem != 1:
    print(2)