hi guys: i solved this problem : http://codeforces.me/problemset/problem/58/A
then i saw a code that an orange user used to solve it , here is the code: import java.util.Scanner; public class Main{
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
String[] str = in.nextLine().split(".*h.*e.*l.*l.*o.*");
System.out.println(str.length == 0 ? "YES" : "NO");
}
}
i understand that the split method splits the String when it finds the String parameter given to it , then it puts the substrings
into the array . but what is all the "." and "*" do? what does this code do?








Let me guess that this is regex. *c will match all characters until c is found. That means in string "ahellou", "*h" will match "ah". And '.' means concatenation. So the pattern means, find match where after some or 0 characters there's 'h', after that after some or 0 character there's e, etc. At last, * means capture the rest of the characters also.(Pardon my Java code... I rarely code in Java)