20 lines
613 B
Plaintext
20 lines
613 B
Plaintext
rep: procedure options (main); /* 5 May 2015 */
|
|
declare s bit (10) varying;
|
|
declare (i, k) fixed binary;
|
|
|
|
main_loop:
|
|
do s = '1001110011'b, '1110111011'b, '0010010010'b, '1010101010'b,
|
|
'1111111111'b, '0100101101'b, '0100100'b, '101'b, '11'b, '00'b, '1'b;
|
|
k = length(s);
|
|
do i = k/2 to 1 by -1;
|
|
if substr(s, 1, i) = substr(s, i+1, i) then
|
|
do;
|
|
put skip edit (s, ' is a rep-string containing ', substr(s, 1, i) ) (a);
|
|
iterate main_loop;
|
|
end;
|
|
end;
|
|
put skip edit (s, ' is not a rep-string') (a);
|
|
end;
|
|
|
|
end rep;
|