编程介的小学生 2017-10-14 14:38 采纳率: 20.5%
浏览 1479
已采纳

Extra Krunch

Description

A krunched word has no vowels ("A", "E", "I", "O", and "U") and no repeated letters. Removing vowels and letters that appear twice or more from MISSISSIPPI yields MSP. In a krunched word, a letter appears only once, the first time it would appear in the unkrunched word. Vowels never appear.

Krunched phrases similarly have no vowels and no repeated letters. Consider this phrase:
RAILROAD CROSSING

and its krunched version:
RLD CSNG

Blanks are krunched differently. Blanks are removed so that a krunched phrase has no blanks on its beginning or end, never has two blanks in a row, and has no blanks before punctuation. Otherwise, blanks not removed. If we represent blanks by "_",
MADAM_I_SAY_I_AM_ADAM__

krunches to:
MD_SY

where the single remaining blank is shown by "_".

Write a program that reads a line of input (whose length ranges from 2 to 70 characters), and krunches it. Put the krunched word or phrase in the output file. The input line has only capital letters, blanks, and the standard punctuation marks: period, comma, and question mark.
Input

A single line to be krunched.
Output

A single krunched line that follows the rules above.
Sample Input

NOW IS THE TIME FOR ALL GOOD MEN TO COME TO THE AID OF THEIR COUNTRY.
Sample Output

NW S TH M FR L GD C Y.

  • 写回答

1条回答

  • threenewbee 2017-10-31 00:35
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有卷积神经网络识别害虫的项目吗
  • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
  • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
  • ¥15 彩灯控制电路,会的加我QQ1482956179
  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件