Anonymous user
Find the missing permutation: Difference between revisions
m
→{{header|REXX}}: added/changed whitespace and comments.
No edit summary |
m (→{{header|REXX}}: added/changed whitespace and comments.) |
||
Line 1,591:
=={{header|REXX}}==
<lang rexx>/*REXX program finds
list = 'ABCD CABD ACDB DACB BCDA ACBD ADCB CDAB DABC BCAD CADB CDBA',
'CBAD ABDC ADBC BDCA DCBA BACD BADC BDAC CBDA DBCA DCAB'
@.= /* [↓] needs to be
@abcU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' /*an uppercase (Latin/Roman) alphabet. */
things = 4 /*
bunch = 4 /*
do j=1 for things /* [↓] only get a portion of alphabet.*/
$.j=substr(@abcU,j,1) /*extract just one letter from alphabet*/
end /*j*/ /* [↑]
call
exit /*stick a fork in it, we're all done. */
/*────────────────────────────────────────────────────────────────────────────*/
if ?>bunch then do
_=;
/* [↓] is in the list? */
if wordpos(_,list)==0 then say _ ' is missing from the list.'
end
else do x=1 for things /*build a
do k=1 for ?-1
if @.k==$.x then
@.?=$.x
end /*x*/
return</lang>
|