0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 20:12:07 +00:00
OI-codes/S2OJ/857/857.cpp

18 lines
338 B
C++

#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;
}