Can someone help me why my code is giving me wrong output ?

Revision en1, by vishudon, 2020-09-20 10:57:07

I was trying to solve a problem, but I encountered a weird error. I don't know why my code is giving me wrong output. Can someone help me what is wrong in my code ? Thanks in advance.

Code

If I am giving this input :

1 2
abc
cdf
edf

then my code is giving me this output : len1 = 2 , len2 = 2 ( while len1 must be 1 )

Note : If I am removing that common string checking part — these two lines ( line1 and line2 ) from 2nd for loop, then it is giving me correct output as len1 = 1 , len2 = 2

Please help me.

Tags c++

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English vishudon 2020-09-20 10:57:07 1244 Initial revision (published)