#include <iostream> #include <cstring> using namespace std; string tolower(string s){ for (char &c:s) { c=tolower(c); } return s; } int main() { string s; cin>>s; s=tolower(s); int a=s.find("bob"); cout<<a<<endl; }
都转化成小写,再用find函数
#include <iostream> #include <cstring> using namespace std; string tolower(string s){ for (char &c:s) { c=tolower(c); } return s; } int main() { string s; cin>>s; s=tolower(s); int a=s.find("bob"); cout<<a<<endl; }
都转化成小写,再用find函数