Longest-prefix matching in C++ for VUT FIT uni course, not the best, but did pretty well