added script to count substrings