Itertools Count Function In Python For Strings In Java