Amdocs interview question

Implement programs.