Solved the question but not sure how to take input


how to differentiate between start of another case and end of input

Hey @Akshay0404 in this case we’ll use cin.eof() to check if the input is end of line or not.

while(!cin.eof()){
//take input of a single testcase which contains n followed by n string and m followed by 2m strings.
}

https://ide.codingblocks.com/s/178354 this code is working in other ide as well as coding blocks ide but when i compile and test here it gives me a runtime error on the same testcase

You need to import list as well
Here is the code with list imported and input taken according to the question