fahimkamal63

272 - TEX Quotes

Apr 26th, 2019
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. //272 - TEX Quotes
  2. #include<iostream>
  3. #include<string>
  4. using namespace std;
  5.  
  6. int main(){
  7.     string str;
  8.     while(getline(cin, str)){
  9.         string s;
  10.         int i = 0,count = 0;;
  11.         while(str[i] != '\0'){
  12.  
  13.             if(str[i] == '"'){
  14.                 count++;
  15.  
  16.                 if(count > 1) {
  17.                     s+= "''";
  18.                     count = 0;
  19.                     i++;
  20.                     continue;
  21.                 }
  22.                 s += "``";
  23.                 i++;
  24.             }
  25.             else{
  26.                 s += str[i++];
  27.             }
  28.  
  29.         }
  30.         cout << s;
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment