0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-09 23:58:48 +00:00

#857. 【2018.8长郡集训day2】最大跨距

https://sjzezoj.com/submission/25010
This commit is contained in:
Baoshuo Ren 2021-08-31 12:09:54 +08:00 committed by Baoshuo Ren
parent 4b6fd25256
commit dc201bad90
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

17
S2OJ/857/857.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <bits/stdc++.h>
using namespace std;
int n, a, l, r;
string s, s1, s2;
int main() {
getline(cin, s, ',');
getline(cin, s1, ',');
getline(cin, s2);
n = s.find(s1);
a = s.rfind(s2);
l = s1.size();
r = s2.size();
cout << (a <= n || a == -1 || n == -1 || a < n + l - 1 ? -1 : a - n - l) << endl;
}