Then it doesn't gather numbers correctly but stores the entire string
That's what you tell it to do with getline(cin,problems)
. I can help you fix it by taking the entire line and parsing it, but I need you to describe the format of the problemset. Just showing your code isn't enough.