by@satos___jp
AC
738ms
{sub(/ +$/,z);if($0){for(;t&&length($0)-length(t);)$0=$0"K";t=$0}print t} T
K
T
T
T
T
T
T
T
T
T
T
T
T
T
T
KKKKKKKKKKKKKKKKK