write a function that given an integer returns the greatest integer that can be created by reversing a subset of its digits