​   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. 开源OA办公平台搭建教程:基于nginx的快速集群部署——端口分发

    主机信息 主机1:172.16.98.8(linux) 主机2:172.16.98.9(linux) 集群需求 172.16.98.8:WEB服务器,应用服务器,文件存储服务器,中心服务器 172.1 ...

  2. 2021 年学习 React 的所需要的 JavaScript 基础

    在理想的情况中,您可以先了解所有有关 JavaScript 和 web 开发的知识,然后再深入了解React. 但是,我们没有办法这样,如果等你把所有 JavaScript 的知识都掌握了再去学习 R ...

  3. vue中v-model的学习

    v-model在表单元素input.radio.checkBox.textarea创建双向数据绑定,他会根据类型选取正确的方法来更新元素,本质不过是语法糖,负责监听用户的输入操作以更新数据并对一些极端 ...

  4. React 中的 onInput/onChange

    参考链接:https://stackoverflow.com/questions/38256332/in-react-whats-the-difference-between-onchange-and ...

  5. 『笔记』2-SAT

    前置 \(SAT\) 是适定性( \(Satisfiability\) )问题的简称.一般形式为 \(k \ -\) 适定性问题,简称 \(k-SAT\) .而当 \(k>2\) 时该问题为 \ ...

  6. ThinVnc-身份验证绕过(CVE-2019-17662)

    ThinVnc-身份验证绕过(CVE-2019-17662) 简介 ThinVNC是一款以网页浏览器为基础设计的远端桌面连接工具,不局限用户端使用那种作业平台,都可以通过采用HTML5为标准的浏览器来 ...

  7. apicloud打包的ios证书的获取方法

    apicloud云编译的时候,需要测试证书或者正式证书进行编译. 那么这个证书是怎么来的呢?通过什么渠道可以获取呢? 这里我介绍下使用香蕉云编这个在线工具来生成: 1.登录香蕉云编,生成证书的csr文 ...

  8. P2766 最长不下降子序列问题 题解(网络流)

    题目链接 最长不下降子序列问题 解题思路 分成三小问解决. 第一小问,求\(LIS\),因为\(n<=500\),直接\(O(N^2)\)暴力求解即可. 第二三小问,建立模型用网络流求解. 对于 ...

  9. 2018.9.9 nowcoder 普及组第一场

    2018.9.9 nowcoder 普及组第一场 C-括号 题目大意:一个只包含左右括号的字符串\(S\),希望删掉S中若干个字符,使得剩下的字符串是一个合法的括号串,有多少不同的方案. Soluti ...

  10. UI透明欺诈

    判断是否存在的代码:   private static boolean c(Activity paramActivity)   {     List localList = ((ActivityMan ...