using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static readonly List<string> Words = new()
{
"switch",
"for",
"namespace",
"if",
"sealed",
"delegate",
"enum",
"checked",
"default",
"event",
"unsafe"
};
static IEnumerable<string> Source()
{
foreach (var w in Words.Where(w => w.Contains('e') || w.Length <= 3 || w.EndsWith("lt")))
yield return w;
}
static bool HasExactlyTwoVowels(string word)
{
return word.Aggregate(
0,
(acc, c) => "aeiou".IndexOf(c) >= 0 ? acc + 1 : acc
) == 2;
}
static string Resolve(Func<IEnumerable<string>, string> rule)
{
return rule(Source().Concat(Words).Distinct());
}
static int Decode()
{
var picks = new[]
{
Resolve(seq => seq.First(w => w.Skip(1).Any() && w[^2..] == "lt")),
Resolve(seq => seq.First(HasExactlyTwoVowels)),
Resolve(seq => seq.OrderBy(w => w).First(w => w.Length == (1 << 1)))
};
return int.Parse(string.Join(
"",
picks.Select(w => w.Length.ToString())
));
}
static Func<int> MainBox()
{
int Wrapper() => Decode();
return Wrapper;
}
static void Main()
{
var box = MainBox();
Console.WriteLine("Co jest w pudełku?");
}
}
N 49° 55.(X - 349)′
E 18° 35.(X - 250)′
You can validate your puzzle solution with
certitude.