​   TEX is a typesetting language developed by Donald Knuth. It takes source text together with a few typesetting instructions and produces, one hopes, a beautiful document. Beautiful documents use “ and ” to delimit quotations, rather than the mundane " which is what is provided by most keyboards.Keyboards typically do not have an oriented double-quote, but they do have a left-single-quote ' and a right-single-quote '. Check your keyboard now to locate the left-single-quote key' (sometimes called the “backquote key”) and the right-single-quote key ' (sometimes called the “apostrophe” or just “quote”). Be careful not to confuse the left-single-quote ` with the “backslash” key . TEX lets the user type two left-single-quotes `` to create a left-double-quote “ and two right-single-quotes '' to create a right-double-quote ”. Most typists, however, are accustomed to delimiting their quotations with the un-oriented double-quote ".

  If the source contained

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

​   then the typeset document produced by TEX would not contain the desired form:“To be or not to be,” quoth the bard, “that is the question.”

​  In order to produce the desired form, the source file must contain the sequence:

 ```To be or not to be,'' quoth the bard,`` that is the question.' '

 ​ You are to write a program which converts text containing double-quote (") characters into text that is identical except that double-quotes have been replaced by the two-character sequences required by TEX for delimiting quotations with oriented double-quotes. The double-quote (") characters should be replaced appropriately by either if the " opens a quotation and by '' if the " closes a quotation. Notice that the question of nested quotations does not arise: The first " must be replaced by , the next by '', the next by`` ``, the next by '', the next by`` , the next by '', and so on.

Input

​   Input will consist of several lines of text containing an even number of double-quote (") characters. Input is ended with an end-of-file character.

Output

The text must be output exactly as it was input except that:
• the first " in each pair is replaced by two ` characters: `` and
• the second " in each pair is replaced by two ' characters: ''.

Sample Input

"To be or not to be," quoth the Bard, "that
is the question".
The programming contestant replied: "I must disagree.
To ``C' or not to `` `C', that is The Question! ' '

HINT

简单的字符变量替换~

Accepted

#include<stdio.h>
int main()
{
char ch;
int flag=0;
while(scanf("%c",&ch)!=EOF)
{
if(ch=='"')
{
if(flag%2==0)
{
printf("``");
flag=1;
}
else{
printf("''");
flag=0;
}
}
else printf("%c",ch);
}
}

TEX Quotes UVA-272的更多相关文章

  1. TeX中的引号(Tex Quotes, UVa 272)

    在TeX中,左双引号是“``”,右双引号是“''”.输入一篇包含双引号的文章,你的任务是 把它转换成TeX的格式. 样例输入: "To be or not to be," quot ...

  2. 例题3_1 TeX中的引号(TeX Quotes,UVa 272)

    在TeX中,左双引号是“``”,右双引号是“''”.输入一篇包含双引号的文章,你的任务是把它转换成TeX的格式. 样例输入: "To be or not to be,"quoth ...

  3. 【OI】Tex Quotes——UVa 272

    题目: TEX is a typesetting language developed by Donald Knuth. It takes source text together with a fe ...

  4. UVa 272 Tex Quotes --- 水题

    题目大意:在TeX中,左引号是 ``,右引号是 ''.输入一篇包含双引号的文章,你的任务是把他转成TeX的格式 解题思路:水题,定义一个变量标记是左引号还是右引号即可 /* UVa 272 Tex Q ...

  5. UVA 272 TEX Quotes

    TEX Quotes 题意: 变引号. 题解: 要想进步,真的要看一本好书,紫书P45 代码: #include<stdio.h> int main() { int c,q=1; whil ...

  6. Uva272.TEX Quotes

    题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  7. 【UVA272】TEX Quotes

    A - TEX Quotes Time Limit:3000MS    Memory Limit:0KB    64bit IO Format:%lld & %llu Submitcid=80 ...

  8. POJ 1488 Tex Quotes --- 水题

    POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...

  9. TEX Quotes(字符串,水)

    TEX Quotes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9674   Accepted: 5073 Descri ...

  10. uva 272 Tex中的引号(Tex Quotes)

    TeX is a typesetting language developed by Donald Knuth. It takes source text together with a few ty ...

随机推荐

  1. 详细探秘Linux 和 Window 双系统访问Windows 磁盘需要输入密码问题解决过程分析

    将要讲很多的内容真正产生作用的配置就只有下面这一句而已.如果你只是想要解决问题看这一句就行了,后面都没有必要在看下去了. 将allow-active标签中的auth_admin_keep 改为 yes ...

  2. 通过CollectionUtils工具类判断集合是否为空,通过StringUtils工具类判断字符串是否为空

    通过CollectionUtils工具类判断集合是否为空 先引入CollectionUtils工具类: import org.apache.commons.collections4.Collectio ...

  3. hive中更改表impala中不能生效

    hive中的更新或者新建表impala 不能实时更新 Impala是基于Hive的大数据实时分析查询引擎,直接使用Hive的元数据库Metadata,意味着impala元数据都存储在Hive的meta ...

  4. ijkplayer接入使用

    1.ijkplayer简介 ijkplayer是一个基于FFmpeg的轻量级Android/iOS视频播放器.FFmpeg的是全球领先的多媒体框架,能够解码,编码, 转码,复用,解复用,流,过滤器和播 ...

  5. WPF 实战 - 翻页控件

    1. 先上效果 <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> ...

  6. teprunner测试平台部署到Linux系统Docker

    本文是一篇过渡,在进行用例管理模块开发之前,有必要把入门篇开发完成的代码部署到Linux系统Docker中,把部署流程走一遍,这个过程对后端设计有决定性影响. 本地运行 通过在Vue项目执行npm r ...

  7. 仿String()构造器函数 【总结】

    需求 实现以下方法: 控制台结果: 需求分析: 首先确定new调用的this和什么对象绑定,如果跟默认返回的对象绑定肯定做不到 [ ] 这样的访问,所以要在构造器内部返回一个包装过的数组 1.leng ...

  8. [源码解析] 并行分布式框架 Celery 之 worker 启动 (1)

    [源码解析] 并行分布式框架 Celery 之 worker 启动 (1) 目录 [源码解析] 并行分布式框架 Celery 之 worker 启动 (1) 0x00 摘要 0x01 Celery的架 ...

  9. java例题_37 有 n 个人围成一圈,顺序排号。从第一个人开始报数(从 1 到 3 报数),凡报到 3 的人退出圈子, 3 问最后留下的是原来第几号的那位。

    1 /*37 [程序 37 报数] 2 题目:有 n 个人围成一圈,顺序排号.从第一个人开始报数(从 1 到 3 报数),凡报到 3 的人退出圈子, 3 问最后留下的是原来第几号的那位. 4 */ 5 ...

  10. java例题_35 找到最大值和最小值并交换位置

    1 /*35 [程序 35 最大最小交换] 2 题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组. 3 */ 4 5 /*分析 6 * 1.先初始化一个数组,然后从键盘获得值 ...