June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
16
Task/ABC-Problem/Red/abc-problem.red
Normal file
16
Task/ABC-Problem/Red/abc-problem.red
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Red []
|
||||
test: func [ s][
|
||||
p: copy "BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"
|
||||
forever [
|
||||
if 0 = length? s [ return 'true ] ;; if string cleared, all chars found/removed
|
||||
if tail? p [ return 'false ] ;; if at end of search block - not found
|
||||
rule: reduce [ first p '| second p] ;; construct parse rule from string
|
||||
either parse s [ to rule remove rule to end ] [ ;; remove found char from string
|
||||
remove/part p 2 ;;character found , remove block
|
||||
p: head p ;;start from remaining string at beginning aka head
|
||||
] [ p: skip p 2 ] ;; else move to next block
|
||||
]
|
||||
]
|
||||
foreach word split {A bark book TrEAT COmMoN SQUAD conFUsE} space [
|
||||
print reduce [ pad copy word 8 ":" test word]
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue