we string letter b we want perform operation on step choose substrings ab string replace string bba if ab substre job Print minimum number step perform job modulo 1097The string ab appear substre letter b right letter string