Replace all Pi question

question:https://hack.codingblocks.com/contests/c/512/71

answer:https://ide.codingblocks.com/s/52750

This code is not producing any output ?

DECLARATION :
string s; // means string has size O
and you cannot do s[x]=‘3’

TO GET RID OF THIS :slight_smile:
USE string s;
to add 3.14 in string;
s=s+“3.14”; //it will add 3.14 and increase its size too

answer:https://ide.codingblocks.com/s/53727
i have updated the code still something is missing can someone point out

Hey Tushar, write the return 0; statement outside the while loop, otherwise your code will print the output for first test case only.

hey i have rectified that mistake but still getting wrong answer. do i have to change the way of taking the input ?

Hey Tushar, you are taking input correctly but the mistake is in replacepi(), your code is not working for all the cases. for eg.
2
xpipippixx
xpppipippix

your code’s output is :
x3.143.14
x

but the expected output is :
x3.143.14p3.14xx
xpp3.143.14p3.14x