华为OD机试题库 C++字符串序列判定 2022第四季度
发布时间
阅读量:
阅读量
字符串序列判定
#include <bits/stdc++.h>
using namespace std;
int find(string S, string L)
{
int lastIndex = -1;
for (char i : S) {
bool isFind = false;
for (int j = lastIndex + 1; j < L.length(); j++) {
if (i == L[j]) {
lastIndex = j;
isFind = true;
break;
}
}
if (!isFind) {
return lastIndex;
}
}
return lastIndex;
}
int main()
{
string S, L;
全部评论 (0)
还没有任何评论哟~
