编程介的小学生 2020-01-16 11:42 采纳率: 20.5%
浏览 84

Refrigerator Magnets 冰箱的问题

Problem Description
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.

Input
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–Z). There will not be any leading or trailing whitespace, and there will not be any blank lines.

Output
Output only the lines which can be written in refrigerator magnets—that is, the lines which have no duplicate letters. Output them exactly the same as they were in the input—white spaces and all. Do not output the final “END” string.

Sample Input
I LOVE YOU
I LOVE MUSTARD
HAPPY BIRTHDAY
GLAD U BORN
SMILE
IMAGINE
WHATS UP DOC
HAVE A NICE DAY
END

Sample Output
I LOVE MUSTARD
GLAD U BORN
SMILE
WHATS UP DOC

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
    • ¥15 求解 yolo算法问题
    • ¥15 虚拟机打包apk出现错误
    • ¥15 用visual studi code完成html页面
    • ¥15 聚类分析或者python进行数据分析
    • ¥15 三菱伺服电机按启动按钮有使能但不动作
    • ¥15 js,页面2返回页面1时定位进入的设备
    • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝