Computation of maximal safe sets for switching systems