Substring for given two chars

Given a string, determine the length of the smallest substring that contains exactly one occurrence of 'a' and one occurrence of 'b' If there are no such substrings, return 0 Input : ahhhxb Output : 6 Input : ahobpa Output : 3 Input : qqqop Output : 0

Answer



No comments:

Post a Comment