Since this problem doesn't have an explicit specification for how large n could be, and the size in characters of each line, it's risky to make assumptions and declare fixed-size arrays to hold the data. However, take the time to read the previous comments from this forum thread. The post made by bill8124 on Jul 27, 2012, for example, has some useful information.fade36776 wrote:i m still getting WA. please help.
Alternatively, you could write a program that doesn't make any assumptions in the size of the input (using C++ structs like strings, vectors, etc.)