We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Looks like the compiler is not properly configured to handle the input. Try this with getline() and you will find an extra \n character is captured. I don't care enough to verify (cin works just fine), but this is probably a Window/Linux/OSX issue with end-of-line (\r\n, \n, \r respectively). Its like the input was created in Windows and the compiler is on a Linux machine.
Still, I could be wrong about this.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Strings
You are viewing a single comment's thread. Return to all comments →
Looks like the compiler is not properly configured to handle the input. Try this with getline() and you will find an extra \n character is captured. I don't care enough to verify (cin works just fine), but this is probably a Window/Linux/OSX issue with end-of-line (\r\n, \n, \r respectively). Its like the input was created in Windows and the compiler is on a Linux machine.
Still, I could be wrong about this.