POJ 2406, Power Strings,  KMP