FastPrepFastPrep
Problem Brief

Check Alphabetical Order ๐ŸŒธ

INTERNOA
See Cisco online assessment and hiring insights

The input consists of a string - inputString, representing the given string.

Print '0' if the given string is in alphabetical order. If not print the index of the character where it is out of alphabetical order.

1Example 1

Input
inputString = "abc"
Output
0
Explanation
The given string "abc" is in alphabetical order, so the output is '0'.

2Example 2

Input
inputString = "asd"
Output
2
Explanation
The given string "asd" is not in alphabetical order, and the character at index '2' is where it is out of order.

Constraints

Limits and guarantees your solution can rely on.

Unknown for now
public int checkAlphabeticalOrder(String inputString) {
  // write your code here
}
Input

inputString

"abc"

Output

0

Sign in to submit your solution.