TEX is a typesetting language developed by Donald Knuth. It takes source text together with a few typesetting instructions and produces, one hopes, a beautiful document. Beautiful documents use “ and ” to delimit quotations, rather than the mundane " which is what is provided by most keyboards...
Problem
- UVa 272 - TEX Quotes
- https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=4&page=show_problem&problem=208
Solution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <vector> | |
#include <list> | |
#include <algorithm> | |
#include <string.h> | |
#include <string> | |
#include <queue> | |
#include <stack> | |
#include <math.h> | |
int main(void) { | |
bool f = false; | |
char c; | |
while(true) { | |
int ret = scanf("%c", &c); | |
if(ret == EOF) break; | |
if(c == '"') { | |
if(!f) printf(""); | |
else printf("''"); | |
f = !f; | |
}else printf("%c", c); | |
} | |
return EXIT_SUCCESS; | |
} |