Best shuffle: Difference between revisions
Content deleted Content added
m →{{header|D}}: Using works with template |
m →{{header|REXX}}: whitespace |
||
Line 127:
=={{header|REXX}}==
<lang rexx>/*REXX program to find best shuffle (of a character string). */▼
▲/*REXX program to find best shuffle (of a character string). */
list='tree abracadabra seesaw elk grrrrrr up a'
Line 142 ⟶ 141:
exit
/*─────────────────────────────────────bestShuffle procedure────────────*/
Line 168 ⟶ 166:
return x
/*─────────────────────────────────────countSame procedure──────────────*/
Line 175 ⟶ 172:
k=k+(substr(x,j,1)==substr(y,j,1))
end
return k</lang>
Output (with a freebie thrown in):
<pre>
original: tree new: eert count: 0
original: abracadabra new: baaracadrab count: 0
|