JNext - SPOJ

In my VS code, this code running fine but getting an error of [SIGSEGV] on SPOJ platform …What am I missing in this code?

c++14 (gcc 8.3)https://ideone.com/8BFy5x

Your code fails for this test case
1
1

We have to find the next greater number with the same set of digits.
so 1 as a test case maybe not possible.
problem :-JNEXT

check this
it’s output should be -1

yaa , Thanks buddy !