PROGRAM A
  IMPLICIT NONE
  CHARACTER(len=3) :: S
  CHARACTER(len=1) :: w1,w2,w3
  INTEGER :: i=0

  READ *, S
  w1 = S(1:1)
  w2 = S(2:2)
  w3 = S(3:3)

  IF (w1=="R") THEN
    i=i+1
    IF (w2==w1) THEN
      i=i+1
      IF (w3==w2) THEN
        i=i+1
      ELSE
      END IF
    ELSE
    END IF
  ELSE
    IF (w2=="R") THEN
      i=i+1
      IF (w3==w2) THEN
        i=i+1
      ELSE
      END IF
    ELSE
      IF (w3=="R") THEN
        i=i+1
      ELSE
      END IF
    END IF
  END IF

  PRINT *, i
END PROGRAM A
