General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
58800190 Practice:
kanishk779
1203D2 - 13 GNU C++17 Accepted 78 ms 1792 KB 2019-08-14 10:12:22 2019-08-14 10:12:23
 
 
→ Source
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int ls,lt;
string s,t;

int main()
{
	cin>>s>>t;
	ls = s.length();
	lt = t.length();
	vector<int> fo(lt);
	vector<int> back(lt);
	int t_i=0,s_i=0;
	while(t_i!=lt)
	{
		if(s[s_i] == t[t_i])
		{fo[t_i]=s_i;t_i++;}
		s_i++;
	}
	t_i=lt-1;s_i=ls-1;
	while(t_i!=-1)
	{
		if(s[s_i] == t[t_i])
		{back[t_i]=s_i;t_i--;}
		s_i--;
	}
	int ans=-1;
	ans = max(back[0],ls-1-fo[lt-1]);
	for(int i=0;i<lt-1;i++)
	{
		ans = max(ans,back[i+1]-fo[i]-1);
	}
	cout<<ans;
	return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details