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