Saturday, April 30, 2016

UVA problem 272 - TEX Quotes

Problem link (Click here)

#include<iostream>
#include<stdio.h>
#include <string.h>

using namespace std;

int main()
{
  char s[1000];
  int count = 0;
  int a;
  while (gets(s))
  {
      a=strlen(s);
      for(int i = 0; i < a; i++)
      {
          if(s[i] == '"'){
              count++;
              if(count%2==0)
                printf("''");
              else
                printf("``");
          }
          else
            printf("%c",s[i]);
      }
      printf("\n");
  }
  return 0;
}


No comments:

Post a Comment