program answer
  implicit none
  character(len=3) :: S
  read(*,*) S
  if(S(1:1)=='R'.and.S(2:2)=='R'.and.S(3:3)=='R') then
     write(*,*) '3'
     stop
  else if(S(1:1)=='R'.and.S(2:2)=='R'.and.S(3:3)=='S') then
     write(*,*) '2'
  else if(S(1:1)=='S'.and.S(2:2)=='R'.and.S(3:3)=='R') then
     write(*,*) '2'
  else if(S(1:1)=='S'.and.S(2:2)=='S'.and.S(3:3)=='S') then
     write(*,*) '0'
  else
     write(*,*) '1'
  end if

  stop
 end program answer