Subtask 1:
Generate all possible substrings and count the number of Tokushuna substrings. The complexity of this is $O(n^2)$
.
Subtask 2:
Traverse the string from beginning and if you find any $\texttt{1}$
then check the previous $\texttt{1}$
in the string.
Let the position of the current $\texttt{1}$
be $C$
and the previous $\texttt{1}$
be $P$
.
If $C-P > 1$
then this is a Tokushuna string.
Complexity: $O(n)$