Microsoft Interview Question

I had to solve a simple problem: Delete all consecutive duplicates in a string: "aaabbbcccaa" -> abca.