Given a number n, find the smallest number that has the same set of digits as n and is greater than n. If n is the greatest possible number with its set of digits, print "not possible".
Asked in the DSA round stage.
Implement next_greater_number(n), where n is a positive integer with no leading zeros. Return the next greater integer formed by permuting all digits of n, or the string "not possible" if no such permutation exists. Repeated digits must be preserved.
def next_greater_number(n):