列表

详情


NC209649. ProblemListheOnlyLovelyProblem

描述

Dreamoon loves lovely things, like lovely girls, lovely bed sheets, lovely clothes...
So he thinks a string is lovely if and only if it begins with the word "lovely"(case insensitive). You are given a string. Please tell us whether Dreamoon thinks that string is lovely. 

输入描述

The input contains only one line.

This line contains a string $s$. The length of $s$ is between $8$ and $10$.

$s$ consists of only the English alphabet. It can be lower case or upper case.

输出描述

If a string is lovely, please output "lovely", Otherwise, output "ugly". (The output is case sensitive).

示例1

输入:

LovelyAA

输出:

lovely

示例2

输入:

lovelymoon

输出:

lovely

示例3

输入:

NOWCOWDER

输出:

ugly

示例4

输入:

LoveLive

输出:

ugly

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

Ruby(2.4.2) 解法, 执行用时: 47ms, 内存消耗: 7156K, 提交时间: 2020-07-18 12:03:51

s = gets.chomp.downcase
puts s[0...6] == 'lovely' ? 'lovely' : 'ugly'

pypy3(pypy3.6.1) 解法, 执行用时: 42ms, 内存消耗: 18672K, 提交时间: 2020-07-18 12:06:35

s = input().lower()
print(['ugly','lovely'][s[:6]=='lovely'])

Python3 解法, 执行用时: 42ms, 内存消耗: 4532K, 提交时间: 2023-05-01 12:22:00

print('lovely'if input()[:6].lower()=="lovely"else"ugly")

上一题