Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
19
Task/Rep-string/PL-I/rep-string.pli
Normal file
19
Task/Rep-string/PL-I/rep-string.pli
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue