from typing import List
import itertools


def changed_token_count(original_tokens: List[List[str]],
                        adversarial_tokens: List[List[str]]) -> List[int]:
  """Given two batches of lists of tokens, this finds per example changes.

  Arguments:
    original_tokens: A batch of lists containing the original sentences' tokens.
    adversarial_tokens: A batch of lists containing the adversarial sentences'
      tokens.

  Returns:
    A list containing how many tokens per example pair are unequal.
  """
  changed_token_counts = []
  for original_sentence, adversarial_sentence in zip(original_tokens,
                                                     adversarial_tokens):
    changed_token_counts.append(0)
    for original_token, adversarial_token in itertools.zip_longest(
        original_sentence, adversarial_sentence, fillvalue=''):
      if original_token != adversarial_token:
        changed_token_counts[-1] += 1
  return changed_token_counts