import java.util.*;
public class Solution {
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param S string字符串
* @param T string字符串
* @return bool布尔型
*/
public boolean isSubsequence (String S, String T) {
// write code here
int sl = S.length();
int tl = T.length();
if (tl < sl) {
return false;
}
boolean bool = true;
char[] tchars = T.toCharArray();
char[] schars = S.toCharArray();
ArrayList<Character> tarray = new ArrayList<>();
for (char tchar : tchars) {
tarray.add(tchar);
}
for (char schar : schars) {
if (tarray.contains(schar)) {
tarray.remove(new Character(schar));
} else {
bool = false;
break;
}
}
return bool;
}
}