Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/ABC-problem/Dyalect/abc-problem.dyalect
Normal file
26
Task/ABC-problem/Dyalect/abc-problem.dyalect
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
func blockable(str) {
|
||||
var blocks = [
|
||||
"BO", "XK", "DQ", "CP", "NA", "GT", "RE", "TG", "QD", "FS",
|
||||
"JW", "HU", "VI", "AN", "OB", "ER", "FS", "LY", "PC", "ZM" ]
|
||||
|
||||
var strUp = str.Upper()
|
||||
var fin = ""
|
||||
|
||||
for c in strUp {
|
||||
for j in blocks.Indices() {
|
||||
if blocks[j].StartsWith(c) || blocks[j].EndsWith(c) {
|
||||
fin += c
|
||||
blocks[j] = ""
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fin == strUp
|
||||
}
|
||||
|
||||
func canOrNot(can) => can ? "can" : "cannot"
|
||||
|
||||
for str in [ "A", "BARK", "BooK", "TrEaT", "comMON", "sQuAd", "Confuse" ] {
|
||||
print("\"\(str)\" \(canOrNot(blockable(str))) be spelled with blocks.")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue