Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
59
Task/Rep-string/Action-/rep-string.action
Normal file
59
Task/Rep-string/Action-/rep-string.action
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
BYTE FUNC IsCycle(CHAR ARRAY s,sub)
|
||||
BYTE i,j,count
|
||||
|
||||
IF sub(0)=0 OR s(0)<sub(0) THEN
|
||||
RETURN (0)
|
||||
FI
|
||||
|
||||
j=1 count=0
|
||||
FOR i=1 TO s(0)
|
||||
DO
|
||||
IF s(i)#sub(j) THEN
|
||||
RETURN (0)
|
||||
FI
|
||||
j==+1
|
||||
IF j>sub(0) THEN
|
||||
j=1 count==+1
|
||||
FI
|
||||
OD
|
||||
IF count>1 THEN
|
||||
RETURN (1)
|
||||
FI
|
||||
RETURN (0)
|
||||
|
||||
PROC Test(CHAR ARRAY s)
|
||||
CHAR ARRAY sub
|
||||
BYTE len,count
|
||||
|
||||
PrintF("%S -> ",s)
|
||||
count=0
|
||||
FOR len=1 TO s(0)-1
|
||||
DO
|
||||
SCopyS(sub,s,1,len)
|
||||
IF IsCycle(s,sub) THEN
|
||||
IF count>0 THEN
|
||||
Print(", ")
|
||||
FI
|
||||
Print(sub)
|
||||
count==+1
|
||||
FI
|
||||
OD
|
||||
IF count=0 THEN
|
||||
Print("none")
|
||||
FI
|
||||
PutE()
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
Test("1001110011")
|
||||
Test("1110111011")
|
||||
Test("0010010010")
|
||||
Test("1010101010")
|
||||
Test("1111111111")
|
||||
Test("0100101101")
|
||||
Test("0100100")
|
||||
Test("101")
|
||||
Test("11")
|
||||
Test("00")
|
||||
Test("1")
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue