Match a pattern and String without using regular expressions
Given two strings, word and pat, your task is to check if the string word follows the pattern of string pat. If the string follows the pattern, find the substring associated with each character of the given pattern string, else print -1.Examples:Input: word = "GraphTreesGraph", pat = "aba"Output: a