IDENTIFICATION DIVISION.
PROGRAM-ID. 175A.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 S          PIC X(03).
01 OUT        PIC 9.
*>
PROCEDURE DIVISION.
  ACCEPT S.
*>
  EVALUATE TRUE
    WHEN S = 'RRR'
      MOVE 3 TO OUT
    WHEN S(1:2) = 'RR'OR S(2:2) = 'RR'
      MOVE 2 TO OUT
    WHEN S(1:1) = 'R' OR S(2:1) = 'R' OR S(3:1) = 'R'
      MOVE 1 TO OUT
    WHEN OTHER
      MOVE 0 TO OUT
  END-EVALUATE.
*>
  DISPLAY OUT.
  STOP RUN.
