package leetcode;

/**
 * https://leetcode.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/
 */
public class Problem1455 {
    public int isPrefixOfWord(String sentence, String searchWord) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1455 prob = new Problem1455();
        System.out.println(prob.isPrefixOfWord("i love eating burger", "burg")); // 4
        System.out.println(prob.isPrefixOfWord("this problem is an easy problem", "pro")); // 2
        System.out.println(prob.isPrefixOfWord("i am tired", "you")); // -1
        System.out.println(prob.isPrefixOfWord("i use triple pillow", "pill")); // 4
        System.out.println(prob.isPrefixOfWord("hello from the other side", "they")); // -1
    }
}

@@ -222,566 +222,218 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1455 prob = new Problem1455();%0A        System.out.println(prob.isPrefixOfWord(%22i love eating burger%22, %22burg%22)); // 4%0A        System.out.println(prob.isPrefixOfWord(%22this problem is an easy problem%22, %22pro%22)); // 2%0A        System.out.println(prob.isPrefixOfWord(%22i am tired%22, %22you%22)); // -1%0A        System.out.println(prob.isPrefixOfWord(%22i use triple pillow%22, %22pill%22)); // 4%0A
+String%5B%5D words = sentence.split(%22 %22);%0A        for (int i = 0; i %3C words.length; i++) %7B%0A            if (words%5Bi%5D.startsWith(searchWord)) %7B%0A                return i + 1;%0A            %7D%0A     
    
+%7D%0A
      
-System.out.println(prob.isPrefixOfWord(%22hello from the other side%22, %22they%22)); //
+   return
  -1
+;
 %0A   

Solve problem 1455