2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
37
Task/ABC-Problem/Elena/abc-problem.elena
Normal file
37
Task/ABC-Problem/Elena/abc-problem.elena
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#import system.
|
||||
#import system'routines.
|
||||
#import system'collections.
|
||||
#import extensions.
|
||||
#import extensions'routines.
|
||||
|
||||
#class(extension)op
|
||||
{
|
||||
#method canMakeWord &from:blocks
|
||||
[
|
||||
#var list := ArrayList new:blocks.
|
||||
|
||||
^ $nil == self literal upperCase seek &each:ch
|
||||
[
|
||||
#var index := list indexOf:(word [ word indexOf:ch &at:0 != -1 ] asComparer).
|
||||
|
||||
(index>=0)
|
||||
? [ list remove &at:index. ^ false. ]
|
||||
! [ ^ true. ].
|
||||
].
|
||||
]
|
||||
}
|
||||
|
||||
#symbol program =
|
||||
[
|
||||
#var blocks := ("BO", "XK", "DQ", "CP", "NA",
|
||||
"GT", "RE", "TG", "QD", "FS",
|
||||
"JW", "HU", "VI", "AN", "OB",
|
||||
"ER", "FS", "LY", "PC", "ZM").
|
||||
|
||||
#var words := ("", "A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "Confuse").
|
||||
|
||||
words run &each:word
|
||||
[
|
||||
console writeLine:"can make '":word:"' : ":(word canMakeWord &from:blocks).
|
||||
].
|
||||
].
|
||||
Loading…
Add table
Add a link
Reference in a new issue