15 lines
494 B
Text
15 lines
494 B
Text
constant tests = {"abracadabra", "seesaw", "elk", "grrrrrr", "up", "a"}
|
|
string s,t
|
|
for test=1 to length(tests) do
|
|
s = tests[test]
|
|
t = shuffle(s)
|
|
for i=1 to length(t) do
|
|
for j=1 to length(t) do
|
|
if i!=j and t[i]!=s[j] and t[j]!=s[i] then
|
|
{t[i], t[j]} = {t[j], t[i]}
|
|
exit
|
|
end if
|
|
end for
|
|
end for
|
|
printf(1,"%s -> %s (%d)\n",{s,t,sum(sq_eq(t,s))})
|
|
end for
|