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

Refrigerator Magnets

问题描述 :

Like many families with small children, my family’s refrigerator is adorned with a set of alphabet magnets: 26 separate magnets, each containing one letter of the alphabet. These magnets can be rearranged to create words and phrases. I feel it is my parental duty to use these magnets to create messages that are witty and insightful, yet at the same time caring and supportive. Unfortunately, I am somewhat hindered in this task by the fact that I can only make phrases that use each letter once.
For example, a nice inspiring message to leave for the children might be, “I LOVE YOU.” Unfortunately, I cannot make this message using my magnets because it requires two letter "O"s. I can, however, make the message, “I LOVE MUSTARD.” Admittedly this message isn’t as meaningful, but it does manage to not use any letters more than once.
You are to write a program that will look at a list of possible phrases and report which phrases can be written using refrigerator magnets.
输入:

The input will consist of one or more lines, ending with a line that contains only the word “END”.
Each line will be 60 characters or less, and will consist of one or more words separated by a single space each, with words using only uppercase letters (A�1�7CZ). There will not be any leading or trailing whitespace, and there will not be any blank lines.
输出:

The input will consist of one or more lines, ending with a line that contains only the word “END”.
Each line will be 60 characters or less, and will consist of one or more words separated by a single space each, with words using only uppercase letters (A�1�7CZ). There will not be any leading or trailing whitespace, and there will not be any blank lines.
样例输入:

I LOVE YOU
I LOVE MUSTARD
HAPPY BIRTHDAY
GLAD U BORN
SMILE
IMAGINE
WHATS UP DOC
HAVE A NICE DAY
END
样例输出:

I LOVE MUSTARD
GLAD U BORN
SMILE
WHATS UP DOC

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-06 01:28
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作