Easy to understand simple java solution beat 97%
using java built in indexOf method to check if the word is a subsequence, then store the subs into a hashset.\n\n\nclass Solution {\n    public int numMatchingS
using java built in indexOf method to check if the word is a subsequence, then store the subs into a hashset.\n\n```\nclass Solution {\n    public int numMatchingSubseq(String S, String[] words) {\n        int sum=0;\n        HashSet<String> sub=new HashSet<>();\n        HashSet<String> nonsub=new HashSet<>();\n        for(String word:words){\n            if(sub.contains(word)){\n                sum++;\n                continue;\n            }\n            if(nonsub.contains(word)){\n                continue;\n            }\n            if(isSub(S, word)){\n                sub.add(word);\n                sum++;\n            }else{\n                nonsub.add(word);\n            }\n        }\n        return sum;\n    }\n    \n    private boolean isSub(String S, String word){\n        int index=-1;\n        for(char ch:word.toCharArray()){\n            index=S.indexOf(ch,index+1);\n            if(index==-1)\n                return false;\n\n        }\n        return true;\n    }\n}\n```
[]