```
public boolean isSubsequence(String s, String t) {
if (t.length() < s.length()) return false;
if (s.length() == t.length()) return s.equals(t);
if (s.length() == 0) return true;
int index1 = 0,index2 = 0;
while (index1<s.length()&&index2<t.length()){
if (s.charAt(index1)==t.charAt(index2)){
index1++;
}
index2++;
}
return index1==s.length();
}
```