Replace integer to string algorithm to compact one