• + 4 comments

    There are unkown number of queries, so your second loop will have to change to a while(1), and catch an exception when there's no input left. Your code is very elegant, though, thanks!