INPUT n
DIM a$(n)
FOR i = 1 TO n
INPUT a$(i)
NEXT
max$ = a$(1)
FOR i = 1 TO n
IF LEN(a$(i)) = LEN(max$) THEN max$ = a$(i)
NEXT
FOR i = 1 TO n
IF MID$(a$(i), 1, 1) = "A" THEN a$(i) = max$
NEXT
FOR i = 1 TO n
PRINT a$(i)
NEXT
Тестирование выполнено в программе QB64 ( Скачать )