Write a program in any language that reads input from stdin and outputs a slightly modified output to stdout. The program should borrow some characters from the input and output as large of a prefix as possible of *language-name* is awesome!
followed by a newline and then what's left of the input.
- The input does not contain any uppercase characters.
- If the first character of the language name is not present in the string, only the newline character should be borrowed.
- If there's no newline character in the input, output the input unmodified.
- It does not matter which of the available characters you borrow.
I'm using \n
as the newline character (0x0a
) to save space when writing. The real program should only care about the real newline character, not the \n
string.
Example: python.
input: abcdefghijklmnopqrstuvwxyz\n0123456789
output: python\nabcdefgijklmqrsuvwxz0123456789
Since the input does not have any spaces, we cannot continue even though we have enough characters for the next word: is
.
Example: C.
input: i don't see anything!
output: i don't see anything!
C was not found in the string, so no modification was possible. Also, no newline character is present.
Example: C++.
input: i don't\nsee anything!
output: \ni don'tsee anything!
C was not found in the string, so no modification was possible.
Example: Obj-C.
input: objectively, clojure is amazing.\nq.e.d.
output: obj\nectively, clojure is amazing.q.e.d.
The input contains enough characters to write obj
but the -
is missing.
Byte count of your source code minus the byte count of your languages' name, utf-8 encoded (if possible), is your score; lowest wins!
i don't\nsee anything!
as a test case? \$\endgroup\$is awesome
, and one that contains the necessary letters but not a newline? \$\endgroup\$