Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define FOR(i, a, b) for(int i = (a); i < (b); ++i)
- #define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
- #define FILL(A,value) memset(A,value,sizeof(A))
- #define ALL(V) V.begin(), V.end()
- #define SZ(V) (int)V.size()
- #define PB push_back
- #define MP make_pair
- const double PI = acos(-1.0);
- typedef long long Int;
- typedef long long LL;
- typedef unsigned long long UINT;
- typedef vector <int> VI;
- typedef pair <int, int> PII;
- typedef pair <double, double> PDD;
- const int INF = 1000 * 1000 * 1000 + 7;
- const LL LINF = INF * (LL)INF;
- const int MAX = 407;
- int c[256];
- int main()
- {
- string a, b;
- cin >> a >> b;
- int pos = 0, res = 0;
- FOR (i,0,SZ(b))
- {
- while (pos < SZ(a) && a[pos] != b[i])
- {
- ++ c[a[pos]];
- ++ pos;
- }
- if (pos == SZ(a))
- {
- cout << -1 << endl;
- return 0;
- }
- ++ pos;
- }
- while (pos < SZ(a))
- {
- ++ c[a[pos]];
- ++ pos;
- }
- FOR (i,0,256)
- res = max(res, c[i]);
- cout << (res+1)/2 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement