Brachylog, 8 bytes
ọtᵒtᵍhth
###Explanation
Explanation
Example input: 495902
ọ Occurences: [[4,1],[9,2],[5,1],[0,1],[2,1]]
tᵒ Order by tail: [[0,1],[2,1],[4,1],[5,1],[9,2]]
tᵍ Group by tail: [[[0,1],[2,1],[4,1],[5,1]],[[9,2]]]
h Head: [[0,1],[2,1],[4,1],[5,1]]
t Tail: [5,1]
h Head: 5