```
class Solution {
public boolean isSubsequence(String s, String t) {
if (s.length() > t.length()) return false;
if (s.length() == t.length()) return s.equals(t);
int i = 0, j = 0;
while (i < s.length()) {
while (j < t.length()) {
if (s.charAt(i) == t.charAt(j)) {
j ++;
break;
}
j ++;
}
i ++;
if (j == t.length()) break;
}
return i == s.length();
}
}
```