Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int part_two() {
- std::ifstream reader("data.txt");
- for (auto [i, x] : std::views::zip(std::views::iota(0),
- std::views::transform(std::views::slide(std::string{std::istreambuf_iterator<char>(reader),
- std::istreambuf_iterator<char>()}, 14), [](auto&& x) {
- return std::unordered_set(x.begin(), x.end());
- })
- )) if (x.size() == 14) return i + 14;
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement