Company: MediBuddy_8oct
Difficulty: medium
First Word Problem Description Consider a letter-rearranging game called "First Word." Each player receives a string S of length N. The goal is to land on the lowest possible score by rearranging the string, using the following move as many times as you like: Pick one letter from among the first K characters of the string, remove it from its current spot, and append it to the end of the string. Once the string S has been rearranged (or left as-is), the score is computed with this formula: Points = Σ i=0 N-1 Position(S[i]) * (N - i) - 1 (indexing starts from 0) Where Position[x] is the index of S in English alphabets (a=1, b=2, c=3, ..., y=25, z=26). If the starting arrangement of S already gives the lowest score, no moves are required. You may apply the move above any number of times. Return the smallest score achievable after rearranging the given string S. Function Description Complete the solve() function. This function takes the following 3 arguments and returns the minimum number