Https://ide.codingblocks.com/s/124621

not getting the output

i also tried this method but getting wrong output.

Since you initializing your output stringbuilder stri also with string, it is basically pointing to the same string. So, you are modifying the same string, and your loop does not run properly. Instead of doing that, initially keep your output stringbuilder empty. Inside the loop, append the ith character to your stringbuilder, then append the difference. Run this loop till i<str.length()-1 and when your loop finishes just add the last character of your input string to stri. This will give you the correct output.

still getting error .plz resolve

Use the stri.append() method instead of insert