Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,28 @@
shared void run() {
function lookAndSay(Integer|String input) {
variable value digits = if (is Integer input) then input.string else input;
value builder = StringBuilder();
while (exists currentChar = digits.first) {
if (exists index = digits.firstIndexWhere((char) => char != currentChar)) {
digits = digits[index...];
builder.append("``index````currentChar``");
}
else {
builder.append("``digits.size````currentChar``");
break;
}
}
return builder.string;
}
variable String|Integer result = 1;
print(result);
for (i in 1..14) {
result = lookAndSay(result);
print(result);
}
}