FAFU OJ TeX括号

106 阅读1分钟

TeX括号

Time Limit:1000MSMemory Limit:65536KB
Total Submissions:115Accepted:61

Share

Description:

      在TeX中,左引号是 '' (两个单引号),右引号是 " (一个双引号)。输入一篇包含双引号的文章,你的任务是把它转换成 TeX 格式。文章长度是 <= 2000 。

Input:

只有一组测试数据,输入文件为一篇文章,文章字符数 <= 2000 。

Output:

将转换后的文章按题意输出。

Sample Input:

"To be or not to be,"quoth the Bard,"that is the question".

Sample Output:

''To be or not to be,"quoth the Bard,''that is the question".

Source:

#include<stdio.h>

int main()
{
	char c;
	bool b=true;
	while((c=getchar())!=EOF)
	{
	    if( c == '\"')
		{
			printf("%s",b ? "''" : "\"" );
			b=!b;
		}
		else
		{
			printf("%c",c);
		}
	}

	return 0;
}


\

\