Output:
For string "A": A For string "ABC": Hello For string "AB": Hello For string "AC": A For string "ACB": A For string "D": failure For string "ABCD": Hello For string "":