It's obvious that you are a programmer while I am not.
I didn't intend to allow for forked paths even though all the keys are contiguous. I do see how my description could be construed that way. Anyhow, it doesn't matter in this case since, as you mentioned, none of the solutions are forked.
My rather crude program also includes repeats and permutations, but once these are culled out, our results agree. It also only allows for only 4 keypresses, a severe limitation.
CLS
DIM b(26, 7)
k = 96
DO WHILE a$ <> "xxx"
READ a$
c = ASC(LEFT$(a$, 1)) - k
FOR b = 1 TO LEN(a$)
b(c, b) = ASC(MID$(a$, b, 1)) - k
NEXT
LOOP
FOR q = 1 TO 26
FOR w = 1 TO 7
IF b(q, w) = 0 THEN EXIT FOR
s = q + b(q, w)
IF s = 29 THEN PRINT CHR$(q + k) + CHR$(b(q, w) + k),
FOR e = 1 TO 7
IF b(w, e) = 0 THEN EXIT FOR
s = q + b(q, w) + b(b(q, w), e)
IF s = 29 THEN PRINT CHR$(q + k) + CHR$(b(q, w) + k) + CHR$(b(b(q, w), e) + k),
FOR r = 1 TO 7
IF b(e, r) = 0 THEN EXIT FOR
s = q + b(q, w) + b(b(q, w), e) + b(b(b(q, w), e), r)
IF s = 29 THEN PRINT CHR$(q + k) + CHR$(b(q, w) + k) + CHR$(b(b(q, w), e) + k) + CHR$(b(b(b(q, w), e), r) + k),
NEXT
NEXT
NEXT
NEXT
END
DATA qaw,wqeas,erwsd,retdf,tryfg,ytugh,uyihj,iuojk,oipkl,pol
DATA aqwsz,swedazx,dersfxc,frtdgcv,gtyfhvb,hyugjbn,juihknm,kiojlm,lopk
DATA zasx,xsdzc,cdfxv,vfgcb,bghvn,nhjbm,mjkn,xxx
|