I know that print writes decoded string on stdout, something like this in Python:
>>> def alt_print(*arg):
... [x.decode(sys.stdin.encoding).encode(sys.stdout.encoding) for x in arg]
... sys.stdout.write(''.join(arg) + '\n') if len(arg) < 2 else sys.stdout.write(str(arg) + '\n')
But it's still hard to understand how does input function actually capture data?
Does it use different process to first print the string and then while loop on another process to listen to the stdin?
Note: I couldn't find answer of this on stackoverflow, my question is how does input specifically works!