Substring count for JS, PHP, Python.