GSPANN QA automation utilities need a compact validation routine for text payloads and a nearly complete numeric sequence. Implement one function that performs both analyses in a single call.
text, preserving case and treating spaces and punctuation as characters.values, containing the integers from 1 through 50 with exactly one value missing and exactly one other value duplicated, return the missing and duplicated values without sorting the input.Implement analyze_input(text, values).
text is a string. values is a list of exactly 50 integers.counts: a dictionary mapping each distinct character to its frequency, in the order characters first appear.missing: the absent integer.duplicate: the integer that occurs twice.The input is valid, and the character count must be case-sensitive. Use linear time and avoid modifying values.
def analyze_input(text, values):