INPUT q$
INPUT w$
FOR i = 1 TO LEN(q$)
FOR j = 1 TO LEN(w$)
IF Mid(q$, i, 1) = Mid(w$, j, 1) THEN
IF INSTR(q$, Mid(q$, i, 1)) >= i THEN
PRINT Mid(q$, i, 1)
EXIT FOR
END IF
END IF
NEXT j
NEXT i
INPUT q$
INPUT w$
FOR i = 1 TO LEN(q$)
FOR j = 1 TO LEN(w$)
IF Mid(q$, i, 1) = Mid(w$, j, 1) THEN
IF INSTR(q$, Mid(q$, i, 1)) >= i THEN
PRINT Mid(q$, i, 1)
EXIT FOR
END IF
END IF
NEXT j
NEXT i