





"""simple docstring"""
def 					__lowerCamelCase       (							a_					:		str			,       a_					:		int							)      ->				Any:
      __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  word.split()

      def justify(a_					:		list			,       a_					:		int			,       a_					:		int							) -> str:
            __SCREAMING_SNAKE_CASE       :Dict		    =  max_width - width
            __SCREAMING_SNAKE_CASE       :str		    =  len(UpperCAmelCase_							)
            if len(UpperCAmelCase_							) == 1:
                  # if there is only word in line
                  # just insert overall_spaces_count for the remainder of line
                  return line[0] + " " * overall_spaces_count
            else:
                  __SCREAMING_SNAKE_CASE       :int		    =  words_count - 1
                  # num_spaces_between_words_list[i] : tells you to insert
                  # num_spaces_between_words_list[i] spaces
                  # after word on line[i]
                  __SCREAMING_SNAKE_CASE       :Tuple		    =  spaces_to_insert_between_words * [
                      overall_spaces_count // spaces_to_insert_between_words
                  ]
                  __SCREAMING_SNAKE_CASE       :Optional[int]		    =  (
                      overall_spaces_count % spaces_to_insert_between_words
                  )
                  # distribute spaces via round robin to the left words
                  for i in range(UpperCAmelCase_							):
                        num_spaces_between_words_list[i] += 1
                  __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  []
                  for i in range(UpperCAmelCase_							):
                        # add the word
                        aligned_words_list.append(line[i]							)
                        # add the spaces to insert
                        aligned_words_list.append(num_spaces_between_words_list[i] * ''' '''							)
                  # just add the last word to the sentence
                  aligned_words_list.append(line[-1]							)
                  # join the aligned words list to form a justified line
                  return "".join(UpperCAmelCase_							)

      __SCREAMING_SNAKE_CASE       :Optional[int]		    =  []
      __SCREAMING_SNAKE_CASE       :Optional[Any]		    =  []
      __SCREAMING_SNAKE_CASE       :List[Any]		    =  0
      for word in words:
            if width + len(UpperCAmelCase_							) + len(UpperCAmelCase_							) <= max_width:
                  # keep adding words until we can fill out max_width
                  # width = sum of length of all words (without overall_spaces_count)
                  # len(word) = length of current word
                  # len(line) = number of overall_spaces_count to insert between words
                  line.append(UpperCAmelCase_							)
                  width += len(UpperCAmelCase_							)
            else:
                  # justify the line and add it to result
                  answer.append(justify(UpperCAmelCase_			,       UpperCAmelCase_			,       UpperCAmelCase_							)							)
                  # reset new line and new width
                  __SCREAMING_SNAKE_CASE    ,__SCREAMING_SNAKE_CASE       :List[str]		    =  [word], len(UpperCAmelCase_							)
      __SCREAMING_SNAKE_CASE       :Tuple		    =  max_width - width - len(UpperCAmelCase_							)
      answer.append(''' '''.join(UpperCAmelCase_							) + (remaining_spaces + 1) * ''' '''							)
      return answer


if __name__ == "__main__":
  from doctest import testmod

  testmod()






"""simple docstring"""
def 					__lowerCamelCase       (							a_					:		str			,       a_					:		str							)      ->				str:
      __SCREAMING_SNAKE_CASE       :int		    =  len(a_							)
      __SCREAMING_SNAKE_CASE       :int		    =  len(a_							)
      __SCREAMING_SNAKE_CASE       :int		    =  (
          first_str_length if first_str_length > second_str_length else second_str_length
      )
      __SCREAMING_SNAKE_CASE       :list		    =  []
      for char_count in range(a_							):
            if char_count < first_str_length:
                  output_list.append(first_str[char_count]							)
            if char_count < second_str_length:
                  output_list.append(second_str[char_count]							)
      return "".join(a_							)


if __name__ == "__main__":
  print(alternative_string_arrange("AB", "XYZ"), end=" ")