Decoupling of second-order linear systems by isospectral transformation