Any approach on how to solve this problem

The question has a greedy tag associated with it.

Ping Ping Ping Ping, anyone ??