ran the same code in IDE the code is working fine with the string but getting trouble with integers they are not in order.