CGI interview question

Coding like finding substring and letters of each word