def str_xor(a, b):
    """
    (string, string) -> string

    xor two strings(a and b) of different lengths

    >>> str_xor("string", "integer")
    '\x1a\x1a\x06\x0c\t\x02'
    >>> str_xor("hello", "world")
    '\x1f\n\x1e\x00\x0b'
    >>> str_xor("foo", "bar!")
    '\x04\x0e\x1d'
    >>> str_xor("AI", "  ")
    'ai'

    :param a: string a
    :param b: string b
    :return: the XORed string
    """
    if len(a) > len(b):
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a[:len(b)], b)])
    else:
        return "".join([chr(ord(x) ^ ord(y)) for (x, y) in zip(a, b[:len(a)])])