a. How many strings are there of length n? Length <= n?
b. How often does any given symbol appear in strings of length <= n?
f^T u(n) = f^T A^n s
and one can get an upper bound on the number of such strings in terms of the largest eigenvalue of A (the Perron eigenvalue).
f^T (sum_{j=1}^n A^j) s =
f^T (I-A^{n+1}) (I-A)^{-1} s
under the assumption that one is not an eigenvalue of A. Of course, sometimes one is an eigenvalue of A!
v_j(n) =
# paths of length n ending at j +
# times symbol a appears on them
The recurrence, in matrix form, looks like
v(n+1) = (A + A(a)) v(n)
f^T (A+A(a))^n s - f^T A^n s.
If we care about strings of length <= n, we again get a geometric series, which is easy except for a little dance around eigenvalue 1.
f^T A(a_n) .. A(a_2) A(a_1) s
So one could potentially correct for duplicate counts.