Monday, March 17, 2014

UVa Solution 272 : TEX Quotes

#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int main()
{
    char ch;
    long long count;
    count=0;
    while(scanf("%c", &ch)==1)
    {
        if(ch=='"')
        {
            count++;
            if(count%2!=0)
            {
                printf("``");
            }
            else
            {
                  printf("''");
            }
        }
        else
        {
            printf("%c", ch);
        }
    }
    return 0;
}

No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...