tolower(char c),将字符c转变小写,不能将整个字符串放进参数里。
substr(int l,int r) 截取字符串[l,r)长度为(r-l)子字符串
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<deque>
#include<iomanip>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10;
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{
string s;
cin >> s;
for(int i=0;i<s.length();i++)
s[i]=tolower(s[i]);
if(s.substr(0,6)=="lovely")
cout << "lovely" << endl;
else cout << "ugly" << endl;
}
本文地址:https://blog.csdn.net/weixin_44235989/article/details/107443706
如对本文有疑问, 点击进行留言回复!!
网友评论