IDENTIFICATION DIVISION.
program-id. Hello.

ENVIRONMENT DIVISION.

DATA DIVISION.
    WORKING-STORAGE SECTION.
        77 N PIC XXXX.
        77 A PIC X.
        77 B PIC X.
        77 C PIC X.
        77 D PIC X.
PROCEDURE DIVISION.
ACCEPT N.
MOVE N(1:1) TO A
MOVE N(2:1) TO B
MOVE N(3:1) TO C
MOVE N(4:1) TO D

IF A = B AND B = C THEN
    DISPLAY "Yes"
    STOP RUN
ELSE IF B = C AND C = D THEN
    DISPLAY "Yes"
    STOP RUN
END-IF
END-IF

DISPLAY "No"
STOP RUN.
