Advertisement
sa072686

Untitled

Feb 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.22 KB | None | 0 0
  1. // input
  2. char c;
  3. // '' or ``
  4. int t = 0;
  5. // char, not string
  6. while (cin >> c)
  7. {
  8.     if (c == '"')
  9.     {
  10.         cout << (t ? "''" : "``");
  11.         // 1 -> 0, 0 -> 1
  12.         t = 1-t;
  13.     }
  14.     else
  15.     {
  16.         // \n, space, or other
  17.         cout << c;
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement