Sequence

Report a typo

Write a program that reads three characters and checks if they are ordered according to the Unicode table, and if each next character immediately follows the previous one (i.e. 'a', 'b', 'c' or 'x', 'y', 'z') according to the alphabet.

The program must print either true or false.

Sample Input 1:

a
b
c

Sample Output 1:

true

Sample Input 2:

c
b
a

Sample Output 2:

false

Sample Input 3:

a
b
d

Sample Output 3:

false

Sample Input 4:

x
y
z

Sample Output 4:

true
Write a program in Kotlin
fun main() {
// put your code here
}
___

Create a free account to access the full topic