题目描述

  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 . The length of is between and .
   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

分析

  要求字符串开头为 "lovely",只需要依次比较字符串开头的六位即可,只需要注意比较是不区分大小写的。

代码

/******************************************************************
Copyright: 11D_Beyonder All Rights Reserved
Author: 11D_Beyonder
Problem ID: 2020牛客暑期多校训练营(第三场) Problem L
Date: 8/14/2020
Description: Easy String Problem
*******************************************************************/
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(){
    string s;
    cin>>s;
    //依次比较6位
    //不区分大小写
    if((s[0]=='l'||s[0]=='L')&&
    (s[1]=='o'||s[1]=='O')&&
    (s[2]=='v'||s[2]=='V')&&
    (s[3]=='e'||s[3]=='E')&&
    (s[4]=='l'||s[4]=='L')&&
    (s[5]=='y'||s[5]=='Y')){
        puts("lovely");
    }else{
        puts("ugly");
    }
    return 0;
}