You have been given a string and you have to find whether bad is a substring of the given string or not.
You can solve this problem by checking whether each character of bad occurs in the string or not. First check for ‘b’ then check for ‘a’ and then for ‘d’. It should be present in the same order and remember to check for the capital letters too. If all three characters are present then print YES otherwise print NO.
Solution can be found here.