sed -E '1d;2~2d :a s/P+-*K+|K+-*P+// ta /P/cP cK'