Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
29
Task/Rep-string/XPL0/rep-string.xpl0
Normal file
29
Task/Rep-string/XPL0/rep-string.xpl0
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
include xpllib; \for StrLen, StrFind and Print
|
||||
|
||||
func RepStr(Str);
|
||||
char Str;
|
||||
int SL;
|
||||
[if Str(0) = 0 then return 0;
|
||||
SL:= StrLen(Str)/2;
|
||||
while SL > 0 do
|
||||
[if StrFind(Str, Str+SL) = Str then
|
||||
return SL;
|
||||
SL:= SL-1;
|
||||
];
|
||||
return 0;
|
||||
];
|
||||
|
||||
int Strs, I, N;
|
||||
char PS;
|
||||
[Strs:= ["1001110011", "1110111011", "0010010010", "1111111111",
|
||||
"0100101101", "0100100", "101", "11", "00", "1"];
|
||||
for I:= 0 to 10-1 do
|
||||
[N:= RepStr(Strs(I));
|
||||
PS:= "^"%s^" = rep-string ^"%1.0s^"\n";
|
||||
PS(22):= N+^0; \ 8-)
|
||||
if N # 0 then
|
||||
Print(PS, Strs(I), Strs(I))
|
||||
else
|
||||
Print("^"%s^" = not a rep-string\n", Strs(I));
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue