Previous and next letter#8610

Previous and next letter (Editorial)

Let be the input character. Print the characters and .

Algorithm implementation

Read the input symbol .

scanf("%c", &c);

Print the symbols c - 1 and c + 1.

printf("%c %c\n", c - 1, c + 1);

Python implementation

Read the input symbol .

c = input()

Compute and print the symbols prev = c - 1 and next = c + 1.

prev = chr(ord(c) - 1)
next = chr(ord(c) + 1)
print(prev, next)