CLS
INPUT a$
INPUT x$
oldi = 1
FOR i = 1 TO LEN(a$)
IF MID$(a$, i, 1) = x$ THEN
k = k + 1
j = i
IF j <> 1 THEN
DO WHILE MID$(a$, j, 1) <> " "
j = j - 1
IF j = 1 THEN EXIT DO
LOOP
END IF
DO WHILE MID$(a$, i, 1) <> " "
i = i + 1
IF i = LEN(a$) THEN EXIT DO
LOOP
PRINT MID$(a$, j, i - j)
END IF
NEXT i
PRINT k