CLS
DIM S AS STRING, R AS STRING, C AS STRING * 1
INPUT "Vvedite stroku:", S
FOR i = 1 TO LEN(S)
C = MID$(S, i, 1)
IF C = "(" THEN f = f + 1
IF C = ")" THEN f = f - 1
IF C = "/" THEN z = 1
IF f > 0 AND C <> "(" AND C <> ")" AND z = 0 THEN C = "?"
R = R + C
NEXT
PRINT "Result: "; R
Тестирование выполнено в программе QB64 ( Скачать )