input: from typing import Union
  
  def is_armstrong_number(num: Union[int, str]) -> bool:
      """Checks if a given number is an Armstrong number.
      >>> is_armstrong_number(153)
      True
      >>> is_armstrong_number(9474)
      True
      >>> is_armstrong_number(123)
      False
      """
      num = int(num)
      n = len(str(num))
      sum_of_digits = 0
      temp = num
  
      while temp > 0:
          digit = temp % 10
          sum_of_digits += digit ** n
          temp //= 10
  
      return num == sum_of_digits
output:     num = int(num)
      n = len(str(num))
      sum_of_digits = 0
      temp = num
  
      while temp > 0:
          digit = temp % 10
          sum_of_digits += digit ** n
          temp //= 10
  
      return num == sum_of_digits