Pergunta de entrevista da empresa Microsoft

Given a string representing path of a file, normalise the string for eg - /a/b/.././c becomes /a/c '..' represents previous directory and . represents current directory.