CLS
INPUT "vvedite kol-vo slov"; n
DIM a$(n), b(n)
FOR i = 1 TO n
INPUT "vvedite slovo"; a$(i)
NEXT
FOR i = 1 TO n
q = 10000
FOR j = 1 TO LEN(a$(i))
b(i) = b(i) + (ASC(LCASE$(MID$(a$(i), j, 1))) * q)
q = q / 10
NEXT
NEXT
FOR i = 1 TO n - 1
min = 1E38
FOR j = i TO n
IF b(j) < min THEN min = b(j): w = j
NEXT
SWAP b(i), b(w)
SWAP a$(i), a$(w)
NEXT
FOR i = 1 TO n
PRINT a$(i)
NEXT