Unique prefix array

not getting desired output pls run the code and you will understand , kindly help

https://ide.codingblocks.com/s/587900