Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Look-and-say-sequence/Sather/look-and-say-sequence.sa
Normal file
27
Task/Look-and-say-sequence/Sather/look-and-say-sequence.sa
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
class MAIN is
|
||||
look_and_say!: STR is
|
||||
current ::= "1";
|
||||
loop
|
||||
yield current;
|
||||
buf ::= #FSTR;
|
||||
last ::= current[0];
|
||||
count ::= 0;
|
||||
loop
|
||||
ch ::= current.elt!;
|
||||
if ch /= last then
|
||||
buf := buf + count + last;
|
||||
last := ch; count := 1;
|
||||
else
|
||||
count := count + 1;
|
||||
end;
|
||||
end;
|
||||
current := (buf + count + last).str;
|
||||
end;
|
||||
end;
|
||||
|
||||
main is
|
||||
loop 12.times!;
|
||||
#OUT+ look_and_say! + "\n";
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue