Problem Description
In Tex, the left double quotation mark is "", and the right double quote is "". Enter an article that contains double quotes, and your task is to convert it into an Tex format.
Sample Input
"To Yes or not," quoth the Bard, "This is the question". The programming contestant replied: "I must disagree." To C ' or not ToC ', which is the question!
Sample Output
To being or not to be, ' quoth the bard,that is the question '. The programming contestant replied: ' I must disagree. ToC ' or not to ' C ', which is the question!
Code
#include <stdio.h>
#include <string.h>
int main ()
{
int flag = 1;//If 1 is the left double quote, 0 is the right double quote
int C;
while ((c = GetChar ())!= EOF)
{
if (c = = ' "')
{
if (flag)//double quotes
{
printf (" "));
Flag =!flag;//Update to 0, next time you see right double quotes
}
else
{
printf ("");
flag =!flag;
}
else printf ("%c", c);
}
return 0;
}