No output being printed

Hello @mohammadabdullahjawwad

You should NOT assign things to indices which do NOT exist. Like the length of the string β€œans” is zero initially so you cannot use ans[1] = β€˜A’ because index 1 does not exist.
What you can use is ans = ans + β€˜A’ (This appends the character β€˜A’ at the back of the string)

Try to print out the ans.length() at the end of your program, you will get 0 as the length.

Here is the modified code

I am still not getting my answer

On submitting all test cases are being passed except the last one

Hello @mohammadabdullahjawwad

Your code fails on below test case
ak
Your output - a:k
Correct Output - a10k