DEFINT A-Z
DIM S AS STRING, Sh AS STRING
CLS
INPUT "Vvedite slovo : ", S
S = LCASE$(S)
Sh = "aeiouy"
FOR i = 1 TO LEN(S)
' Ищем 2-ю гласную
IF k < 2 THEN
FOR j = 1 TO LEN(Sh)
IF MID$(S, i, 1) = MID$(Sh, j, 1) THEN k = k + 1: c = i: EXIT FOR
NEXT
IF k = 1 THEN c2 = i - 1
END IF
' Идем назад от 2-й гласной согласные
IF k = 2 THEN
k = 0
FOR l = c - 1 TO c - 2 STEP -1
IF l > 0 THEN
f = 1
FOR j = 1 TO LEN(Sh)
IF (l > 0) AND (MID$(S, l, 1) = MID$(Sh, j, 1)) THEN f = 0: t = l
NEXT
k = k + f
END IF
NEXT
IF t = c - 1 THEN PRINT "Oshibka! Glasnye dolgny razdelatsa soglasnimi."
IF k = 1 THEN c = c2: GOTO 5
IF k = 2 THEN c = c - 2: GOTO 5
EXIT FOR
END IF
NEXT
PRINT "Slog ne naiden!"
END
5 PRINT "Pervij slog : "; LEFT$(S, c)
Тестирование выполнено в программе QB64 ( Скачать )