Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
44
Task/ABC-problem/CLU/abc-problem.clu
Normal file
44
Task/ABC-problem/CLU/abc-problem.clu
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
ucase = proc (s: string) returns (string)
|
||||
rslt: array[char] := array[char]$predict(1,string$size(s))
|
||||
for c: char in string$chars(s) do
|
||||
if c>='a' & c<='z' then
|
||||
c := char$i2c(char$c2i(c) - 32)
|
||||
end
|
||||
array[char]$addh(rslt,c)
|
||||
end
|
||||
return(string$ac2s(rslt))
|
||||
end ucase
|
||||
|
||||
abc = proc (s: string) returns (bool)
|
||||
own collection: sequence[string] := sequence[string]$
|
||||
["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS",
|
||||
"JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
|
||||
|
||||
blocks: array[string] := sequence[string]$s2a(collection)
|
||||
for c: char in string$chars(ucase(s)) do
|
||||
begin
|
||||
for i: int in array[string]$indexes(blocks) do
|
||||
if string$indexc(c, blocks[i]) ~= 0 then
|
||||
blocks[i] := ""
|
||||
exit found
|
||||
end
|
||||
end
|
||||
return(false)
|
||||
end
|
||||
except when found: end
|
||||
end
|
||||
return(true)
|
||||
end abc
|
||||
|
||||
start_up = proc ()
|
||||
po: stream := stream$primary_output()
|
||||
words: sequence[string] := sequence[string]$
|
||||
["A", "BARK", "BOOK", "TREAT", "COMMON", "SQUAD", "CONFUSE"]
|
||||
|
||||
for word: string in sequence[string]$elements(words) do
|
||||
stream$puts(po, word || ": ")
|
||||
if abc(word) then stream$putl(po, "yes")
|
||||
else stream$putl(po, "no")
|
||||
end
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue