Need help in UVa 455 - Periodic Strings

judge
matching
online
pattern
problem
string
uva

#1

Can someone please tell me what is wrong in my code. Thanks in advance.

This is the link of the problem.

This is my solution code.