25
4
Story
Have you seen this post from 9gag? Maybe you got the feeling to make your own sentences. But then you realize that you could just golf a script in half an hour, and you will never have to deal time with that.
The submission
Your program will get an input string which it will return with added quotation marks as explained below. Standard loopholes are forbidden. Output as a list of lines is allowed. Trailing spaces and empty lines that don't break the output are allowed.
The rules of input
- The input only contains printable ASCII characters.
- The input may contain spaces. The words are determined with them.
- It's guaranteed that a space will never be followed by another space.
- The case of no input or empty string doesn't matter.
The rules of output
If one word is given then the program has to return the string between quotation marks.
If the input string has 2 or more words, it first returns the initial input, but the first word is in quotation marks. Then on the next line, it returns the initial input, but with the second word in quotes. And so on for the remaining words.
In general, the program has to return as many lines as there are words in the input.
Examples:
test -> "test"
This is codegolf -> "This" is codegolf
This "is" codegolf
This is "codegolf"
This is a significantly longer, but not the longest testcase -> "This" is a significantly longer, but not the longest testcase
This "is" a significantly longer, but not the longest testcase
This is "a" significantly longer, but not the longest testcase
This is a "significantly" longer, but not the longest testcase
This is a significantly "longer," but not the longest testcase
This is a significantly longer, "but" not the longest testcase
This is a significantly longer, but "not" the longest testcase
This is a significantly longer, but not "the" longest testcase
This is a significantly longer, but not the "longest" testcase
This is a significantly longer, but not the longest "testcase"
Here is an another one -> "Here" is an another one
Here "is" an another one
Here is "an" another one
Here is an "another" one
Here is an another "one"
This is code-golf, so the least byte answer wins!
7Will there be duplicate words? – Embodiment of Ignorance – 2019-05-10T22:26:28.920
10Can we assume the input string will not contain
"
characters? – Doorknob – 2019-05-10T23:00:11.0731
Re "Strive to be lazy": I think this is a misrepresentation of what Larry Wall said. - "Most folks see laziness as a synonym for slacker or couch potato, but Wall's definition is about efficiency."
– Peter Mortensen – 2019-05-11T02:47:20.26014This "problem" should be "fun" to "golf". – Lyxal – 2019-05-11T06:26:03.677
3Can we use different quotes, like
''
,‘’
, or“”
, rather than""
? – Giuseppe – 2019-05-13T17:59:52.123