L.Problem L is the Only Lovely Problem
题目链接-L.Problem L is the Only Lovely Problem
题目大意
当且仅当字符串
s
s
s以单词
l
o
v
e
l
y
lovely
lovely开头时(不区分大小写),认为这个字符串
s
s
s是可爱的,请你判断字符串
s
s
s是否可爱
解题思路
- 因为不区分
l
o
v
e
l
y
lovely
lovely的大小写,所以我们可以先用
tolower()
函数把前六个字符化为小写字母,然后再判断s.substr(0,6)
是否 为lovely
即可 - 具体操作见代码
附上代码
#pragma GCC optimize("-Ofast","-funroll-all-loops")
#include<bits/stdc++.h>
#define int long long
#define lowbit(x) (x &(-x))
#define endl '\n'
using namespace std;
const int INF=0x3f3f3f3f;
const int dir[4][2]={-1,0,1,0,0,-1,0,1};
const double PI=acos(-1.0);
const double e=exp(1.0);
const double eps=1e-10;
const int M=1e9+7;
const int N=2e5+10;
typedef long long ll;
typedef pair<int,int> PII;
typedef unsigned long long ull;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
string s;
cin>>s;
for(int i=0;i<6;i++)
s[i]=tolower(s[i]);
if(s.substr(0,6)=="lovely")
cout<<"lovely"<<endl;
else
cout<<"ugly"<<endl;
return 0;
}