Index coding models broadcast networks in which a sender sends different messages to different receivers simultaneously, where each receiver may know some of the messages a priori. The aim is to find the minimum (normalised) index codelength that the sender sends. This paper considers unicast index coding, where each receiver requests exactly one message, and each message is requested by exactly one receiver. Each unicast index-coding instances can be fully described by a directed graph and vice versa, where each vertex corresponds to one receiver. For any directed graph representing a unicast index-coding instance, we show that if a maximum acyclic induced subgraph (MAIS) is obtained by removing two or fewer vertices from the graph, then the minimum index codelength equals the number of vertices in the MAIS, and linear codes are optimal for the corresponding index-coding instance. Using this result, we solved all unicast index-coding instances with up to five receivers, which correspond to all graphs with up to five vertices. For 9819 non-isomorphic graphs among all graphs up to five vertices, we obtained the minimum index codelength for all message alphabet sizes; for the remaining 28 graphs, we obtained the minimum index codelength if the message alphabet size is $k^2$ for any positive integer $k$. This work complements the result by Arbabjolfaei et al. (ISIT 2013), who solved all unicast index-coding instances with up to five receivers in the asymptotic regime, where the message alphabet size tends to infinity.