You already know how to find all of the 1’s; you should be able to do something similar to find all of the 0’s.
If the sum of those two counts is not the length of the string, there must be at least one illegal character in it.
solved How to clarify whether the user’s input was a binary number? [closed]