@pradeep
thanks
@dearvivekkumar
thanks for reminding it, and that put me the idea that the algorithm can be improved to save few loops