# Make an ed clone

ed is the standard text editor on Unix systems. Your goal is to write an ed clone.

Write a program that reads an input stream and for every received end of line character, print ? followed by a end of line character.

• The communication has to interactive. Means the program needs to output as soon as possible and has to accept more input after that.
• There are no input lines that are longer than 105 characters + end of line character
• You can choose which character or sequence you use as end of line character, as long as it does not contain any alphanumerical characters nor the ? character.
• The program should not output anything else.

Shortest code wins.

## Example Python Script

#/usr/bin/env python3

import sys

for line in sys.stdin:
print("?")

• How is this an ed clone? It doesn't seem to edit files. Jan 7 at 22:12
• @WheatWizard It is a joke. Because ed returns ? for almost every input. Jan 10 at 11:41

# Charcoal, 5 bytes

?ＷＳＤ⎚


Try it online! Link is to verbose version of code. Explanation:

?


Write a ? to the canvas, but don't print anything yet.

ＷＳ


Repeatedly input lines until there is nothing left to input...

Ｄ


... dump the canvas with a trailing newline.

⎚


Clear the canvas so that nothing gets output at the end.

• I upvoted that for respect. I like your answer. Jan 8 at 1:01

$_="?" Try it online! # Ruby + -pl, 5 bytes $_=??


Try it online!

# Nibbles, 2 bytes

@"?"


That's 4 nibbles at half a byte each in the binary form.

@ is the first line of input but auto maps all lines if there's more input after the first line.

Despite the simplicity of this problem I must thank it for making me make sure Nibbles is properly lazy enough to do interactive IO right. There was an issue in that it adds a newline at termination unless your last character was a newline (to not double print newlines), but that wasn't being done lazy enough and so it wasn't interactive enough to satisfy this question. But I've fixed it in latest commit (you'll need latest unstable version of nibbles).

# Python 3, 40 27 bytes

for i in open(0):print("?")


Try it online!

-13 thanks to @ovs

• You can use open(0) instead of sys.stdin and get rid of the input
– ovs
Jan 7 at 21:39