You have a license key string s containing alphanumeric characters and dashes. You also have an integer k. Reformat the string so that each group has exactly k characters, except the first group which can be shorter. All letters must be uppercase. Google asks this in phone screens to evaluate your string manipulation and attention to edge cases.
For s = "5F3Z-2e-9-w" and k = 4, the output is "5F3Z-2E9W". Remove all dashes, uppercase everything, then group from right to left in chunks of .
Think about how to handle the first group being shorter than the rest.
Constraints: , .