Made Z algorithm code shorter.