CLS
LINE INPUT "vvedite text: "; t$
FOR i = 1 TO LEN(t$)
IF MID$(t$, i, 1) = "," THEN k = k + 1
NEXT
PRINT k
INPUT "FILE NAME "; F$
OPEN F$ FOR INPUT AS #1
DO
Q = 0
LINE INPUT #1, T$
DO
Q = INSTR(Q + 1, T$, ",")
IF Q > 0 THEN N = N + 1 ELSE EXIT DO
LOOP
LOOP UNTIL EOF(1)
PRINT N
Тестирование выполнено в программе QB64 ( Скачать )