ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1563. Bayan

If you use cin in C++
Posted by John 12 Jan 2022 22:36
I had a hard time with this, so hopefully I will save your time. Read input like this:

int n; cin >> n;
string t;
getline(cin, t); // Necessary to process end of first line (nothing after n)
....
// Now keep getting each line with getline(cin, t)