WA UVa Tex Quotes

Hi! This is my code for UVa Tex Quotes problem, I think my code is correct but it shows WA, is there any problem with the usage of functions that I have used for string parsing? Please help.

Thank you!

The Problem is in your solution is that you are checking " in your every line and you are replacing first occurrence of it with ``. It may be possible that first occurrence of " can be replaced by ’ '.

Your solution can be corrected if you place int c= 1 outside the while loop so that it will not make c = 1 at the start of every line.

Your Code:
string s; while(getline(cin,s)){ size_t pos=s.find("\""); int c=1; while(pos!=string::npos){

Corrected Code:

string s;
int c=1;
          size_t pos=s.find("\"");

Still wrong answer. :frowning:

Thanks Harsh! I did a foolish mistake. I was printing the string everytime when I was checking the code. And I submitted the same code.

And thank you, I thought we had to process every line.