Function isn't returning string

Function encrypt is supposed to return a string.but it isn’t returning.
Here is a link to the problem:

@alvi_aeras
It can only return the string if it ever reaches the return statement. Your code goes in an infinite loop in the first while loop. The break condition is not hit and your code runs infinitely and hence never gets to the return statement.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.