A good first step would be to write a program that asks for input and then just display that. Once you get to that level, you take a step backwards and just write down a set of instructions in your native language and consider how to bend your program to fit.
1. First instruct the user on std output to enter a random string of characters followed by a carriage return.
2. Read a line from std input.
3. Write that line to std output.
If you first get yourself organized and demonstrate some willingness to work the problem, you'll get more and better assistance than if you simply post your homework assignment. If there was simple "standard way" to do it, the world wouldn't need any programmers.
I no longer wish to be associated with this site.