编程介的小学生 2017-07-20 09:46 采纳率: 20.5%
浏览 777
已采纳

Mark-up

Problem Description
Mark-up languages are computer languages that assist in the formatting of text files. Special keywords are used to mark the text to allow control of fonts, page styles, paragraph styles, etc. TeX, troff, and HTML are examples of mark-up languages.

Spell checking can be difficult to adapt to these special texts. In general, special processors or spell checkers must be created in order to accommodate mark-up languages. A special processor would recognize the mark-up language and strip it from the text so that the ``plain'' text could then be processed by a spell checker. For this problem, you are to write such a processor for a small mark-up language so that the output of your program will be the plain text without the mark-ups.

The mark-up language to consider is one which allows the modification of fonts within the text. Each markup command will be preceded by a \ character. If the letter following the \ character is not a recognized command from the table below then the character following the \ is printed as part of the plain text. For instance, the mark-up \ can be used to print a single .

\b
toggle bold font on/off (default state is off)
\i
toggle italics font on/off (default state is off)
\s
set font size; the s is immediately followed by an optional number; if the number is missing then the command will restore the previous size
*
toggle processing of mark-ups on/off; if processing is toggle off then mark-ups are considered to be literal text (default state is on)

The number following the \s command can have a decimal point so 12, 9.5, 11., and .5 should all be recognized as valid numbers.

Input
The input file will be plain text containing mark-ups from the language above. At the start, processing of mark-ups should be on. The file should be processed until the end-of-file is encountered.

Sample Input
\s18.\bMARKUP sample\b\s

*For bold statements use the \b command.*

If you wish to \iemphasize\i something use the \i command.

For titles use \s14BIG\s font sizes, 14 points usually works well.

Remember that all of the commands toggle except for the \s command.

Sample Output
MARKUP sample

For bold statements use the \b command.

If you wish to emphasize something use the \i command.

For titles use BIG font sizes, 14 points usually works well.

Remember that all of the commands toggle except for the \s command.

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-08-03 16:29
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料