feat: add quiz 2 counter.

This commit is contained in:
2025-05-19 21:26:47 +08:00
parent 651bc79d2e
commit a4624b477f
7 changed files with 92 additions and 0 deletions

21
counter/main.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include <counter.h>
#include <iostream>
int main(const int argc, char** argv)
{
if (argc != 2)
{
std::cout << "ERROR: Need a string." << std::endl;
}
const std::string input(argv[1]);
const auto map = counter::Counter::count(input);
for (const auto& pair : map)
{
std::cout << pair.first << ' ' << pair.second << std::endl;
}
return 0;
}