4. Two students, A and B, are selecting courses from five subjects. They have exactly one course in common, and A selects more courses than B. The number of ways A and B can select courses to meet the above conditions is $\qquad$

翻译完成，保留了原文的换行和格式。
4. 155.

For the courses that both A and B choose, there are $\mathrm{C}_{5}^{1}$ ways to select. For the remaining courses, at most one of A or B can choose each course. Let $(a, b)$ represent the scenario where A chooses $a$ courses and B chooses $b$ courses from the remaining four courses.