General Motors (GM) interview question

Distance between some points. Parsing standard input