Solution for String Matching