Uber | OA | Count occurrence of one string in another string

Given two strings s and t. Count the number of occurence of 't' in 's' as follows:

  • Length of t is 3,
  • Increment count when t == s[i]s[i+2]s[i+4]

Example:
s = aabbcc
t = abc
output = 2

Comments (1)