Question d’entretien chez Microsoft

Write a function that performs run-length encoding on a string.