Tuesday, February 16, 2016

UVA 272 - TEX Quotes

#include<bits/stdc++.h>
char s[1000000];
using namespace std;
int main()
{
    char a[]="``",b[]="''";
    int j=0;
    while(gets(s)){
    for(int i=0; i<strlen(s); i++){
        if(s[i]=='"' && j==0){
            cout<<a;
            j=1;
        }
        else if(s[i]=='"' && j==1){
            cout<<b;
            j=0;
        }
        else
            cout<<s[i];
    }
    cout<<"\n";
    }

    return 0;
}

No comments:

Post a Comment