max substring with two different character by interview