program main
 implicit none
   character*3::word

   read*,word

   if(word(1:1)=='S' .and. word(2:2)=='S' .and. word(3:3)=='S') print*,0
   if(word(1:1)=='R' .and. word(2:2)=='S' .and. word(3:3)=='S') print*,1
   if(word(1:1)=='S' .and. word(2:2)=='R' .and. word(3:3)=='S') print*,1
   if(word(1:1)=='S' .and. word(2:2)=='S' .and. word(3:3)=='R') print*,1
   if(word(1:1)=='R' .and. word(2:2)=='S' .and. word(3:3)=='R') print*,1
   if(word(1:1)=='R' .and. word(2:2)=='R' .and. word(3:3)=='S') print*,2
   if(word(1:1)=='S' .and. word(2:2)=='R' .and. word(3:3)=='R') print*,2
   if(word(1:1)=='R' .and. word(2:2)=='R' .and. word(3:3)=='R') print*,3

end program main