题目链接:https://ac.nowcoder.com/acm/contest/5668/L
题意:判断一个字符串是否lovely开头,不分大小写
题解:将字符串全部换成小写字母,判断该字符串开头是否未lovely
1 #include<iostream> 2 #include<string> 3 #include<algorithm> 4 using namespace std; 5 6 int main() { 7 string s; 8 cin >> s; 9 transform(s.begin(),s.end(),s.begin(),::tolower); 10 string t = s.substr(0,6); 11 if(t == "lovely") cout<<"lovely"<<endl; 12 else cout<<"ugly"<<endl; 13 return 0; 14 }