R、46 45バイト
cat(gsub("^\\w\\W*\\K\\w*","",scan(,""),T,T))
これにより、STDINから行が読み取られ、STDOUTに出力されます。正規表現を使用して、最初の文字の後にすべての文字を削除し、その後に句読点を追加します。
非ゴルフ+説明:
# Read a string from STDIN and convert it to a character vector,
# splitting at spaces
input <- scan(what = "")
# Replace stuff with nothing using a regex.
# ^ start position anchor
# \w single "word" character
# \W* any amount of non-word (i.e. punctuation) characters
# \K move the match position forward
# \w* any number of word characters
replaced <- gsub("^\\w\\W*\\K\\w*", "", input, ignore.case = TRUE, perl = TRUE)
# Print the vector elements to STDOUT, separated by a space
cat(replaced, sep = " ")
例:
> cat(gsub("^\\w\\W*\\K\\w*","",scan(,""),T,T))
1: I'm a little teapot, short and stout. Here is my handle, here is my spout. When I get all steamed up - hear me shout! Tip me over and pour me out.
I' a l t, s a s. H i m h, h i m s. W I g a s u - h m s! T m o a p m o.