Google Interview Question

It was a leetcode medium question, word pattern matching on keyboard.