Pergunta de entrevista da empresa Tata Consultancy Services

given two strings, one pattern string and other is text string. find the number of occurances of pattern string in text string.