Digit Insurance interview question

get a string variable (in few specified formats) and return it in a particular format.