Tex quotes, UVa 272_uva

Source: Internet
Author: User

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;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.