The plate 2 is the common plate between 1 and 3 and it is connected to negative end of battery. So its charge should be −(q+q)=−2q.
Similarly plate 3 is in between 2 and 4 but it is connected to positive end of battery. So its charge =+2q and plate 4 is in between 3 and 5 and it is connected to negative end of battery. So its charge should be −(q+q)=−2q.
Plate 5 is single plate and it is connected to positive end of battery. So its charge =+q