HELP WITH PERMUTATIONS AND COMBINATIONS PROBLEMS WITH STRINGS

Given a string with ones and zeros find the number of substrings which start and end with 1.
how will the answer change if the string contains all numbers 0-9?