Company: ubs_29july
Difficulty: medium
Get Maximum Ones Problem Description You are given a binary string s containing only the characters '0' and '1', and an integer k . You may perform at most k operations. In a single operation you: Choose an index i with 0 <= i < length(s) - 1 , and Update the character at that index to s[i] = max(s[i], s[i + 1]) . Because '1' > '0', this means the character at index i becomes '1' when s[i + 1] is already '1'; in every other situation s[i] is left exactly as it was. The character at index i + 1 is never modified, so a '1' is copied one step to the left rather than moved. Determine the maximum number of '1' characters the string can contain after performing at most k operations. Input Format The first line contains the binary string s . The second line contains the integer k . Output Format Print a single integer: the maximum possible number of '1' characters in s after at most k operations. (inferred - the source describes a function that returns this value; the judge compares