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

Solution

#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;
}
view raw uva-272.cpp hosted with ❤ by GitHub