Implement two string utility functions | xAI Interview Question