Kattis Set 10 - String Processing and BSTA+Other