×

# WA UVa Tex Quotes

 0 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! asked 07 Jul '15, 00:08 3★ho_oh 75●7 accept rate: 33%

 0 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; while(getline(cin,s)){ size_t pos=s.find("\""); while(pos!=string::npos){ answered 07 Jul '15, 01:20 36●2 accept rate: 12% Still wrong answer. :( (07 Jul '15, 11:06) ho_oh3★ 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. (07 Jul '15, 11:18) ho_oh3★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,919
×643
×68
×8

question asked: 07 Jul '15, 00:08

question was seen: 1,236 times

last updated: 07 Jul '15, 11:18