There is a small error in the code.
You have taken the size of string array as k but so you should access the elements from 0 to k-1 but you are accessing the elements form 1 to k.
1 Like
thanks a lot
got ac