Solve SRM 151, Div 2, Problem PrefixCode