program rainy_season
  character(3) :: s
  read *, s
  if(s == "RRS" .or. s == "RSR" .or. s == "SRR")then
  print *, 2
  else if(s == "RRR")then
  print *, 3
  else if(s == "SSR" .or. s == "SRS" .or. s == "RSS")then
  print *, 1
  else
  print *, 0
  end if
end program