fork download
  1. #include<iostream>
  2. #include<cstring>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string s;
  8. while(getline(cin,s)){
  9. size_t pos=s.find("\"");
  10. int c=1;
  11. while(pos!=string::npos){
  12. if((c&1)==1)
  13. s.replace(pos,1,"``");
  14. else
  15. s.replace(pos,1,"''");
  16. c++;
  17. pos=s.find("\"",pos+1,1);
  18. }
  19. cout<<s<<"\n";
  20. }
  21. }
Success #stdin #stdout 0s 3232KB
stdin
"To be or not to be," quoth the Bard, "that is the question".
The programming contestant replied: "I must disagree. To `C' or not to `C', that is The Question!"
stdout
``To be or not to be,'' quoth the Bard, ``that is the question''.
The programming contestant replied: ``I must disagree. To `C' or not to `C', that is The Question!''