Works, but not providing the chains of words KATTIS wants