Implement a simplified grep with extensible flags | Bloomberg Interview Question