find substring ac solution