Aspire Systems Interview Question

Related to strings polymorphism pattern problem