this maybe be a simple task...but I'm finding it very hard to do
I need a formula that convents repeated digits into unique digits example:

787 = 78

or

7788735 = 7835

each value has its only cell.
being at it for days now....any ideas