Find the next permutation in lex order

a) 1432 -> 2134
b) 54123 -> 54132
c) 12453 -> 12534
d) 45231 -> 45312
e) 6714235 -> 6714253
f) 31528764 -> 31542678