Maximum Hamming distance among a list of padded strings The Hamming distance between two strings of equal length is the number of positions at which the corresponding characters are different. If the strings are not of equal length, the Hamming distance is not defined. 

Challenge

Write a program or function that finds the largest Hamming distance from among all pairs of strings from a list of strings, padded as required according to the rules described below. 

The characters will be from within a-zA-Z0-9.

The strings may not be equal in length, so for each comparison the shorter string has to be padded as follows:


wrap the string from the beginning as many times as needed to match the required length
change the cases of the letters each odd time wrapping (1st, 3rd, 5th, etc.)
leave things outside a-zA-Z unchanged when wrapping


For example, let's say you need to pad the 5 character string ab9Cd so that it ends up with 18 characters. You would end up with:

ab9CdAB9cDab9CdAB9
     ^^^^^     ^^^


with ^ added underneath the 1st and 3rd wraps to highlight to case changes.

Input/Output

Input/output format is flexible. You can assume the input has at least two strings, and that all strings will have at least one character. 

The output is an integer.

Rules

This is code-golf. Standard rules apply.

Test cases

[ "a", "b" ] =&gt; 1
[ "a", "b", "c" ] =&gt; 1
[ "a", "a", "c" ] =&gt; 1
[ "abc", "abcd" ] =&gt; 1
[ "abc12D5", "abC34d3", "ABC14dabc23DAbC89d"] =&gt; 17  
[ "a", "Aaa", "AaaA", "aAaAa", "aaaaaaaaaaaaaa", "AAaAA", "aAa" ] =&gt; 8
["AacaAc", "Aab"] =&gt; 2


Reference implementation

I tested the examples with (completely ungolfed) R code that you can try here to compare any other examples you might try out with your code.
Jelly, 20 bytes

Not really happy with it. Should be golfable, even to ~15 bytes perhaps.

LÞŒcµṁ/sḢL$ŒsÐeFn)§Ṁ


Try it online!

or Check out a test suite!

Explanation


LÞŒcµṁ/sḢL$ŒsÐeFn)§Ṁ    Full program or monadic link. N = input.                     | Example: ["abc12D5", "abC34d3", "ABC14dabc23DAbC89d"]
LÞ                      Sort N by length.                                            | [['a', 'b', 'c', '1', '2', 'D', '5'], ['a', 'b', 'C', '3', '4', 'd', '3'], ['A', 'B', 'C', '1', '4', 'd', 'a', 'b', 'c', '2', '3', 'D', 'A', 'b', 'C', '8', '9', 'd']] (in Jelly, strings are list of characters)
  Œc                    Unordered pairs: [x, y] for all distinct x, y in N.          | [[['a', 'b', 'c', '1', '2', 'D', '5'], ['a', 'b', 'C', '3', '4', 'd', '3']], [['a', 'b', 'c', '1', '2', 'D', '5'], ['A', 'B', 'C', '1', '4', 'd', 'a', 'b', 'c', '2', '3', 'D', 'A', 'b', 'C', '8', '9', 'd']], [['a', 'b', 'C', '3', '4', 'd', '3'], ['A', 'B', 'C', '1', '4', 'd', 'a', 'b', 'c', '2', '3', 'D', 'A', 'b', 'C', '8', '9', 'd']]]
                        Here, by distinct, I mean at different positions.            |
    µ            )      Map with a monadic link.                                     |
     ṁ/                 Mold x like y. That is, cycle x until it reaches length y.   | [['a', 'b', 'c', '1', '2', 'D', '5'], ['a', 'b', 'c', '1', '2', 'D', '5', 'a', 'b', 'c', '1', '2', 'D', '5', 'a', 'b', 'c', '1'], ['a', 'b', 'C', '3', '4', 'd', '3', 'a', 'b', 'C', '3', '4', 'd', '3', 'a', 'b', 'C', '3']]
       sḢL$             Split into chunks of x's length.                             | [[['a', 'b', 'c', '1', '2', 'D', '5']], [['a', 'b', 'c', '1', '2', 'D', '5'], ['a', 'b', 'c', '1', '2', 'D', '5'], ['a', 'b', 'c', '1']], [['a', 'b', 'C', '3', '4', 'd', '3'], ['a', 'b', 'C', '3', '4', 'd', '3'], ['a', 'b', 'C', '3']]]
           ŒsÐe         Swap the case of even-indexed chunks (1-indexed).            | [[['a', 'b', 'c', '1', '2', 'D', '5']], [['a', 'b', 'c', '1', '2', 'D', '5'], ['A', 'B', 'C', '1', '2', 'd', '5'], ['a', 'b', 'c', '1']], [['a', 'b', 'C', '3', '4', 'd', '3'], ['A', 'B', 'c', '3', '4', 'D', '3'], ['a', 'b', 'C', '3']]]
               F        Flatten.                                                     | [['a', 'b', 'c', '1', '2', 'D', '5'], ['a', 'b', 'c', '1', '2', 'D', '5', 'A', 'B', 'C', '1', '2', 'd', '5', 'a', 'b', 'c', '1'], ['a', 'b', 'C', '3', '4', 'd', '3', 'A', 'B', 'c', '3', '4', 'D', '3', 'a', 'b', 'C', '3']]
                n       Vectorized inequality with y.                                | [[[0, 0, 1, 1, 1, 1, 1]], [[1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], [[1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1]]]
                  §     After ending the map, sum each bool (0 or 1) array.          | [[5], [17], [14]]
                   Ṁ    Maximum.                                                     | 17