I just halved the string and checked for both halves being equal for part 1 and good old regex for part 2.