Text this: Optimal number of imperfect repairs for deteriorating systems