debug S[2:(n-1)]