不好意思,这个asp我还是有些问题的,给你这个QB程序吧。
DECLARE FUNCTION solve$ (txt AS STRING)
DEFINT A-Z
DIM a AS STRING, b AS INTEGER
INPUT a
PRINT solve(a)
END
FUNCTION solve$ (txt AS STRING)
DIM a(1000), lnth, i, j, max, p(1000), mp, h AS STRING
lnth = LEN(txt)
FOR i = 1 TO lnth
FOR j = 1 TO i - 1
IF MID$(txt, lnth - i + 1, 1) >= MID$(txt, lnth - j + 1, 1) AND a(i) < a(j) + 1 THEN a(i) = a(j) + 1: p(i) = j
NEXT
IF a(i) > max THEN max = a(i): mp = i
NEXT
i = mp: h = ""
DO
h = h + MID$(txt, lnth - i + 1, 1)
i = p(i)
LOOP UNTIL i = 0
solve$ = h
END FUNCTION
测试了,应该没有问题。Qb可以在这里下载
http://aysten.3322.org/tools/qbasic.rar
|