47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#include <span>
|
|
#include <algorithm>
|
|
#include <ranges>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
#include "fmt/std.h"
|
|
|
|
#include "aoc/types.hpp"
|
|
#include "aoc/utils.hpp"
|
|
|
|
using namespace std::string_view_literals;
|
|
using namespace aoc::types;
|
|
|
|
// starts at 50
|
|
[[maybe_unused]]constexpr auto raw_str = R"(
|
|
11-22,95-115,998-1012,1188511880-1188511890,222220-222224,
|
|
1698522-1698528,446443-446449,38593856-38593862,565653-565659,
|
|
824824821-824824827,2121212118-2121212124
|
|
)";
|
|
|
|
static auto entry([[maybe_unused]]std::span<char const*> const& args) -> void {
|
|
std::string str{raw_str};
|
|
// auto str = aoc::read_text("./input.txt").value_or("");
|
|
str = aoc::trim(str);
|
|
|
|
auto ids_str = str | std::views::split(","sv) | std::views::transform([](auto const& str) {
|
|
return aoc::trim({std::begin(str), std::end(str)});
|
|
}) | std::ranges::to<std::vector>();
|
|
|
|
for (auto const& id : ids_str) {
|
|
std::print("{}\n", id);
|
|
}
|
|
}
|
|
|
|
auto main([[maybe_unused]]int argc, [[maybe_unused]]char const* argv[]) -> int {
|
|
try {
|
|
entry({argv, std::next(argv, argc)});
|
|
} catch (std::exception const& e) {
|
|
fmt::print(stderr, "{}\n", e.what());
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|