Write a program that reads from standard input a sequence of whitespace-separated 'words'. The program should output each word on its own line, but only including the characters that are equal or adjacent in the ASCII table. For example, the character ' ' has an ASCII value of 105, and it should be included in the output only if it is next to an ℎ (104), an i (105), or a j (106). In your solution, you must use a void function named FilterNeighbors, that takes in a string, and filters it based on the problem specification.
Example InDut:
Expected Output:
hikktBraaa
The first ' ' isn't in the output because its only neighbor ( ℎ ) is not adjacent to it in the ASCII table. The ' ℎ ' and the ' ' are adjacent in the table so they are outputted. The ' 's are equal to each other, so they are also outputted. And so on.
Example Input:
23321 gbsyfbjlbsadfoebw ./-$1&%aAJ
{1}:<:≥ ?
Expected Output:
23321
./$8%
{|}:
"Remember that there are lots of characters in ASCII beyond just letters. The ""gbsyfbjlbsadfoebw"" word contains to letters that are adjacent in the word and in the table, so its line is empty."
When writing your program, you may only use concepts you have learned in the course thus far.
Your program should compile and run.
The formatting must match exactly as shown in the example above, including whitespaces.