Ok @ramini , your output for 66666666666666666 is coming -1 which is wrong
@spp___ There’s no single digit input in this question. Read the constraints carefully.
2<= n <= 10^5
n= no.of digits the number has !!!
Try the following:
333966 => 33966
369369 => 69369
123456 => 12456
123126 => 12312
654321 => 65421
162132 => 16212
167137 => 17137
137167 => 17167