Could anyone tell me how to load this input in the most elegant way possible ? I just need to know how to load it and possibly when the input is not in the given format ( does not start with '[' or there's not ',' or it does not start and end with '{' , '}' it should print: "Invalid input". I was thinking of using cin load 1st bracket then ask if it's a '{' then load [x,y], ( with cin and stop when format[5] == '}' ) in this format becuase cin reads everything untill space, change numbers to int and save it to array or vector but i just think it's kind of stupid way of dealing with this problem and there must be something simple and elegant. I'll be really thankful.