A school punishes students if they are absent more than once per term, or if they are ever late 3 days in a row. Accordingly, every day, for each student, the school records a single letter: 'A' for absent, 'O' for on time, and 'L' for late. For example: "LAOLL" (Here, the student is not in trouble because there is only one absence, and although there are 3 late days, they are not consecutive.)
Write a program that returns the number of strings of length 30 for which the student is in good standing.
I could not figure out the solution to this problem, I feel that the solution could've been found using backtracking but I ran out of time before I could figure anything out :(