GATE Computer ScienceHardGATE CSE

How many strings of length 8 over {a, b} contain aa as a substring but do not contain bb as a substring?

  1. A. 55
  2. B. 48
  3. C. 53
  4. D. 61

Correct answer: C. 53

Strings with no bb number F(10)=55; among them subtract those with no aa either, i.e. alternating strings (2). Direct enumeration gives 53.

More Theory of Computation questions

Exams that ask this topic