版本比较
You too!
正文
增加 3 行删除 3 行
6 行未改动789101112131415161718195 行未改动2526272829303132336 行未改动int countYoutoo(const string& str) {int count = 0;string target = "youtoo";int targetLen = target.length();if (str.length() < targetLen) {return 0;}for (size_t i = 0; i <= str.length() - targetLen; i++) {if (str.substr(i, targetLen) == target) {count++;}5 行未改动string input;cin>>input;int result = countYoutoo(input);cout << result << endl;return 0;}```6 行未改动789101112131415161718195 行未改动2526272829303132336 行未改动int countYoutoo(const string& str) {int count = 0;string target = "youtoo";int targetLen = target.length();if (str.length() < targetLen) {return 0;}for (size_t i = 0; i <= str.length() - targetLen; i++) {if (str.substr(i, targetLen) == target) {count++;}5 行未改动string input;cin>>input;int result = countYoutoo(input);cout << result << endl;return 0;}```