Best shuffle: Difference between revisions

m
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). */
<lang rexx>
/*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>
</lang>
Output (with a freebie thrown in):
<pre>
<pre style="height:20ex;overflow:scroll">
original: tree new: eert count: 0
original: abracadabra new: baaracadrab count: 0
Anonymous user