Sherlock and the Valid String

Problem Name:
Sherlock and the Valid String
Site:HackerRank
Links:
Tags:
Problem setters: