pub fn a_or_an(word: &str) -> &'static str {
  let vowels = ['a', 'e', 'i', 'o', 'u'];
  let lowercase_word = word.to_lowercase();

  // Special cases where the article should be "a"
  let special_cases_a = ["one"];
  if special_cases_a.contains(&lowercase_word.as_str()) {
    return "a";
  }

  // Special cases where the article should be "an"
  let special_cases_an = ["hour"];
  if special_cases_an.contains(&lowercase_word.as_str()) {
    return "an";
  }

  let first_char = lowercase_word.chars().next();

  match first_char {
    // If the first character is a vowel, return "an"
    Some(c) if vowels.contains(&c) => "an",
    // Otherwise, return "a"
    _ => "a",
  }
}

pub fn number_to_words(n: i32) -> String {
  let ones = [
    "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
  ];
  let teens = [
    "ten",
    "eleven",
    "twelve",
    "thirteen",
    "fourteen",
    "fifteen",
    "sixteen",
    "seventeen",
    "eighteen",
    "nineteen",
  ];
  let tens = [
    "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety",
  ];

  if n < 10 {
    ones[n as usize].to_string()
  } else if n < 20 {
    teens[(n - 10) as usize].to_string()
  } else if n < 100 {
    let ten_part = tens[(n / 10) as usize];
    let one_part = ones[(n % 10) as usize];
    if n % 10 == 0 {
      ten_part.to_string() // e.g., 20 → "twenty"
    } else {
      format!("{}-{}", ten_part, one_part) // e.g., 42 → "forty-two"
    }
  } else {
    "Number out of range".to_string() // Handle numbers >= 100 (or extend the logic)
  }
}
