IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_089_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP    PIC X(200).
    01 maxlen PIC 9(3).
    01 cur    PIC 9(3)  VALUE 1.
    01 i      PIC 9(18) VALUE 1.
    01 j      PIC 9(18).
    01 len    PIC 9(3).

    01 S      PIC X(1).

    01 N      PIC 9(3).

    01 cnt    PIC 9(3).
PROCEDURE                        DIVISION.
MAIN.
    ACCEPT N.

    ACCEPT INP.

    MOVE 0 TO cnt.

    MOVE N TO maxlen.

    PERFORM maxlen TIMES

        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO S

        IF S = 'Y' THEN
            MOVE 1 TO cnt
            EXIT PERFORM
        END-IF

        COMPUTE cur = j + 1

        ADD 1 TO i

    END-PERFORM.

    IF 0 < cnt THEN
        DISPLAY "Four"
    ELSE
        DISPLAY "Three"
    END-IF.

    STOP RUN.
