public static void Main()
private static bool IsListAlpabeticallySorted(string[] words, char[] alphabet) {
for (int i = 0; i < words.Length -1; i++) {
if (!IsPairSorted(words[i], words[i+1], alphabet)) {
private static bool IsPairSorted(string wordA, string wordB, char[] alphabet) {
bool wordAisShorter = wordA.Length < wordB.Length;
int shorterWordLength = wordAisShorter ? wordA.Length : wordB.Length;
for (int i = 0; i < shorterWordLength; i++) {
if (!IsFirstLetterFirstInAlphabet(wordA[i], wordB[i], alphabet)) {
private static bool IsFirstLetterFirstInAlphabet(char a, char b, char[] alphabet) {
for(int i = 0; i < alphabet.Length; i++) {
if (indexA == -1 || indexB == -1) {
throw new Exception("invalid letter");