Microsoft Interview Question

They asked me two questions about string manipulation.