Uva Problem 272 - TEX Quotes Solution

Problem Link
Uva Problem 272 - TEX Quotes Solution

Solution:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[1000000];
    int i = 0;
    bool c=true;
    while(gets(s))
    {
        for(int j = 0; s[j]; j++)
        {
            if(s[j] == '\"')
            {
                if(c == false)
                    cout << "\'" << "\'";
                else
                    cout << "`" << "`";
                c=!c;
            }
            else cout << s[j];
        }
        cout << endl;
    }
    return 0;
}

No comments

Theme images by enjoynz. Powered by Blogger.