Piece of alphabet

Report a typo

Write a program that reads a string and outputs "true" only when the letters of this string form a substring of the ordered English alphabet, for example, "abc", "xy", "pqrst".

Otherwise, it should print out "false".

Note: string can consist of a single character. Assume an empty string as an alphabet substring.

Sample Input 1:

abc

Sample Output 1:

true

Sample Input 2:

bce

Sample Output 2:

false
Write a program in Java 17
class Main {
public static void main(String[] args) {
// put your code here
}
}
___

Create a free account to access the full topic