UVa 272 TEX Quotes
難題寫多了,來寫渣渣題。AC 0.020秒
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<cstdio> | |
int main() | |
{ | |
int c; | |
int inQuotes = 0; | |
while ((c = getchar()) != EOF) | |
{ | |
if (c == '"') | |
{ | |
if (inQuotes) //close quotes | |
{ | |
putchar('\''); | |
putchar('\''); | |
} | |
else //start quotes | |
{ | |
putchar('`'); | |
putchar('`'); | |
} | |
inQuotes = !inQuotes; | |
} | |
else | |
{ | |
putchar(c); | |
} | |
} | |
return 0; | |
} |
留言
張貼留言