a bracket sequence string contain character a regular bracket sequence shortly rbs bracket sequence transform correct arithmetic expression insert character 1 original character sequence for example bracket sequence regular result expression 11 111 bracket sequence you give stre s rbs you apply number operation string each operation follow type choose nonempty prefix s remove s s rbs for example apply operation follow 10 character remove choose contiguous nonempty substring s remove s s rbs for example apply operation follow character 7th 10th remove the operation 2 apply k time calculate maximum number operation apply s