Problem ยท String

Check Alphabetical Order ๐ŸŒธ

Learn this problem
โ— EasyCiscoINTERNOA
See Cisco hiring insights

Problem statement

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.

Function

checkAlphabeticalOrder(inputString: String) โ†’ int

Examples

Example 1

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

Example 2

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

Constraints

Unknown for now

More Cisco problems

drafts saved locally
public int checkAlphabeticalOrder(String inputString) {
  // write your code here
}
inputString"abc"
expected0
checking account