The first line of the input contains a sequence of letters.
The second line of the input contains some text.
Your task is to determine whether any of the words from the second line contain this sequence of letters. Count only the words that do not start or end with your search term. If such a word is present in the line, output "YES", otherwise output "NO". The word can contain only the letters of the English alphabet. Ignore the case while searching for matches.
Patterns and Matcher
In the middle of a word
Report a typo
Sample Input 1:
Gramm
Java is the most popular programming languageSample Output 1:
YESSample Input 2:
Press
Regular expressions is hard to read, isnt it?Sample Output 2:
YESSample Input 3:
some
Wow! How awesome is that!Sample Output 3:
NOWrite a program in Java 17
import java.util.*;
import java.util.regex.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String part = scanner.nextLine();
String line = scanner.nextLine();
// write your code here
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.