Itertools Count Function In Python For String Javascript