```
public boolean isSubsequence(String s, String t) {
if(s.length() > t.length()) return false;
int left=0, right=s.length()-1;
while(left<=right){
int first = t.indexOf(s.charAt(left));
int last = t.lastIndexOf(s.charAt(right));
if(first == -1 || last == -1) return false;
if (left!=right && first>=last) return false;
if(left<right) t= t.substring(first+1, last);
left++; right--;
}
return true;
```

}