Z Algorithm

Please could anyone explain the O(n) method of Z Array computation. I understood what it is but could not understand how to code it properly. Could anyone help me ? I studied it from codeforces.

Link

Read this [z-algo][1]
[1]: http://binfalse.de/2010/09/08/advanced-searching-via-z-algorithm/

I used this link already for understanding the concept…Thank you…but didn’t understood the code

HERE:

http://binfalse.de/2010/09/08/advanced-searching-via-z-algorithm/