#include <leetcode.h>
|
static string | replaceWords (vector< string > &dictionary, const string &sentence) |
|
◆ replaceWords()
string leetcode::UhWRSj::Solution::replaceWords |
( |
vector< string > & |
dictionary, |
|
|
const string & |
sentence |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 1264 行定义.
1265 auto oss = ostringstream();
1266 auto *
const nstr =
new char[sentence.length() + 1];
1268 for(
const auto &
root: dictionary) {
1271 strcpy(nstr, sentence.c_str());
1272 char *word = strtok(nstr,
" ");
1273 while(word !=
nullptr) {
1274 oss << tn.get_prefix(
"",
string(word)) <<
" ";
1275 word = strtok(
nullptr,
" ");
1277 const string ans = oss.str();
1279 return ans.substr(0, ans.length() - 1);
引用了 acwing::acwing836_408::root.
被这些函数引用 leetcode::UhWRSj::TEST().
该类的文档由以下文件生成: