Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
15
Task/Rep-string/Applesoft-BASIC/rep-string.basic
Normal file
15
Task/Rep-string/Applesoft-BASIC/rep-string.basic
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
10 FOR Q = 0 TO 0: READ S$:L = LEN (S$): ON L > 0 GOSUB 20: NEXT Q: END
|
||||
20 LET R$ = ""
|
||||
30 ON L > 1 GOSUB 70
|
||||
40 PRINT S$":"R$ MID$ (" NONE",1,5 * ( LEN (R$) = 0))
|
||||
50 LET Q = - 1
|
||||
60 RETURN
|
||||
70 FOR I = INT (L / 2) TO 1 STEP - 1
|
||||
80 T$ = "": FOR T = 0 TO 0:T$ = T$ + LEFT$ (S$,I):T = - ( LEN (T$) < L): NEXT T: IF LEFT$ (T$,L) = S$ THEN R$ = R$ + " " + LEFT$ (S$,I)
|
||||
90 NEXT I: RETURN
|
||||
100 DATA "1001110011","1110111011"
|
||||
110 DATA "0010010010","1010101010"
|
||||
120 DATA "1111111111","0100101101"
|
||||
130 DATA "0100100","101"
|
||||
140 DATA "11","00"
|
||||
150 DATA "1",""
|
||||
4
Task/Rep-string/Ed/rep-string.ed
Normal file
4
Task/Rep-string/Ed/rep-string.ed
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
H
|
||||
g/([01]*)\1(.*)/s//\1/
|
||||
,p
|
||||
Q
|
||||
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