Challenge:

• Read a string s invisibly.
• For each of the characters in s, print a character c.
• In realtime.

Rules:

• You must print c in realtime. As soon as the user enters a character you must display c.
• c must be constant, i.e. it must be the same character.
• c can be any visible character (i.e. it cannot be a newline, space, tab, or unprintable).
• c can't be based on s, i.e. c must be defined/constant before s is read.
• c must be the same every time the program is run.
• c can be one of the characters in s if by accident, as long as all other rules are followed.
• None of the characters of s may appear on the screen, c excepted (see previous rule).
• You may use any reasonable methods of input and output as long as all other rules are followed.
• You may assume that the length of s is never longer than the terminal/graphical window width.
• If using a terminal, your program should terminate after a newline or EOF is entered.

Example:

If s was password01 and c was *, the output would look something like:

Winner:

The shortest submission in each language wins.

• Is python with tkinter allowed for our custom input field (like the one in HTML), such that the program does not terminate when enter is pressed, but when you close the Entry's Window (X on Windows and cmd+W on mac)? – Mr. Xcoder Jun 9 '17 at 16:35
• @Mr.Xcoder Yes, that's valid. – MD XF Jun 9 '17 at 16:36
• Can we use Ctrl+J to represent a literal newline in the terminal? Alternatively, can we use Ctrl+Z instead of enter? – Conor O'Brien Jun 9 '17 at 16:43
• @ConorO'Brien Clarifying how input should end in the terminal. – MD XF Jun 9 '17 at 16:44
• What should happen if the user presses backspace? – zdimension Jun 10 '17 at 20:51

Python 2 (*nix only), 75 bytes

import sys,tty
i=sys.stdin
tty.setraw(i)


(Warning: messes up your stdin and doesn't fix it, so maybe run in a screen instance if you don't want to have to restart your console).

Rod has a (shorter) Python 2 answer that only works on Windows - here's a Python 2 version that works on *nix (and not Windows, I think)

• Regarding the terminal messing, running reset after the script finishes solves it. – manatwork Jul 5 '17 at 14:40

Befunge, 18 bytes

"**"~:!#@_0!_ #,_


Enter a null byte to stop input

><>, 10 bytes

"i:?!;1+?o


Try It Here

Enter a null byte to end input

Aheui (esotope), 43 bytes

밣발따밯밧밧누
희）빠뫃쳐）뎌


Try it online!

Unfortunately, I couldn't find interactive Aheui interpreter. Aheui processer made with Javascript looks like somewhat interactive, but it doesn't print till input !!!. And input !!! just terminates program.

Many Aheui implementation put -1 into stack when there are no more input, and this code checks if input is -1. If not, just print )`, because its ascii code is 40, easy to make.