[Question]
  [
Given two strings, output a third string that is not equal to either of the two inputs, but has the same length (in characters) as either of the inputs. There is guaranteed to be at least one valid output.
# Test Cases
Test cases are quoted to show they are strings. Outputs are one of many possible.
```
input, input -> output
"test", "test" -> "tttt"
"do", "don't" -> "dnut_"
"ye s", "yes" -> "fals"
"yes", "yes" -> "noo"
"maybe", "mayue" -> "false"
"false", "false" -> "truee"
"false", "true" -> "fatr"
"1", "" -> "0"
"", "t" -> "s"
"", "abcabc" -> "testst"
"abcdefghijklmnopqrstuvwxyz", "aaaaaaaaaaaaaaaaaaaaaaaaaa" -> "zbcdefghijklmnopqrstuvwxya"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" -> "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
```
## Rules
* You may chose your input domain, but it must be composed of at least printable ASCII, and your output domain must be the same as your input domain.
* The input lengths may be the same or different.
* The output must be valid with probability 1; that is, you may generate random strings until one is valid (and theoretically you might infinite loop), but you can't just output a random string and hope it's valid. Note that this means you output does not need to be deterministic.
* Automatic trailing newlines allowed, but they do not count towards the length of the output.
* Due to questions regarding Memory Errors, it must work within 60 seconds up to input lengths of `6`. An answer that works for that and theoretically works for longer strings is OK, but something that Memory Errors on modern computer for input length `4` is not valid.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer in bytes wins.
  
[Answer]
# Haskell, 43 bytes
```
x!y=[s|s<-(<$max x y)<$>"abc",s/=x,s/=y]!!0
```
Takes the max (lexicographically later) string, which we know is nonempty; replaces all characters with one of "a", "b", and "c" using `<$`; and returns the first that is neither of the inputs. I think this is similar to [Neil's Charcoal answer](https://codegolf.stackexchange.com/a/139625/19857) and/or [geokavel's CJam answer](https://codegolf.stackexchange.com/a/139627/19857).
(I've lurked for a while but this is my first time answering on this site; hi!)
[Answer]
# Brainfuck, 97 bytes
```
+>+[-,[>>,]<<[<<]>]>>[>]<<<[<]>[<+>>[-<+<+>>][>]<[->+<]<[-]>>>++<[<]>[.>>]>[>>]]>[+[>]+[<]>[.>>]]
```
[Run code online](https://copy.sh/brainfuck/?c=IyBMZXQgKEtuKSBiZSB0aGUgbnRoIGNoYXJhY3RlciBvZiBLCiMgTGV0ICheKSBkZXNpZ25hdGUgdGhlIHBvaW50ZXIKIyBMZXQgRiBiZSB0aGUgZmlyc3Qgc3RyaW5nIGlucHV0dGVkCiMgTGV0IFMgYmUgdGhlIHNlY29uZCBzdHJpbmcgaW5wdXR0ZWQKCis-K1stICAjIFR3aWNlIGRvCixbPj4sXSAgIyBJbnB1dCBzdHJpbmcgKGNoYXJhY3RlcnMgc2VwYXJhdGVkIGJ5IDEpCjw8Wzw8XT4gICMgR28gdG8gbGVmdCBvZiBiZWdpbm5pbmcgb2Ygc3RyaW5nCl0-ICAjIEVuZCBvbiBmaXJzdCBjaGFyYWN0ZXIgb2Ygc2Vjb25kIHN0cmluZwojIElmIHNlY29uZCBzdHJpbmcgaXMgbnVsbCB3ZSB3aWxsIGVuZCBvbmUgdG9vIGZhciB0byB0aGUgbGVmdAo-Wz5dPDw8WzxdPiAgIyBJZiBmaXJzdCBzdHJpbmcgaXMgbnVsbCB3ZSB3aWxsIGVuZCB0aGVyZSB0b28KIyBXZSB3aWxsIHVzZSB0aGlzIHRvIGRvIGZsb3cgY29udHJvbAoKWyAgIyBPbmx5IHJ1biBpZiBib3RoIHN0cmluZ3Mgd2VyZSBub24gbnVsbAoKIyBUYXBlOiAgICBTMCAnIEYwICcgUzEgJyBGMSAnIFMyICcgRjIgJyBldGMKIyAgICAgICAgICBeCgo8Kz4-ICAjIExldCBGMCogPSBGMCAocGx1cykgMSAgKGlzIDEgYXMgb2Ygbm93OyBGMCB3aWxsIGJlIGFkZGVkIGxhdGVyKQpbLTwrPCs-Pl0gIyBMZXQgQSA9IFMwIChwbHVzKSBGMAojIEEgbWF5IG9yIG1heSBub3QgYmUgemVybwojIEYwKiBtYXkgb3IgbWF5IG5vdCBiZSB6ZXJvCiMgVGFwZTogICAgRjAqICcgQSAnIDAgICcgUzEgJyBGMSAnIGV0YwojICAgICAgICAgICAgICAgIF4KCls-XTxbLT4rPF0gICMgTGV0IEIgPSBBIG9yIEYwKgojIEIgbWF5IG9yIG1heSBub3QgYmUgemVybwo8Wy1dPj4gICMgQ2xlYXIgRjAqCiMgVGFwZTogICAgIDAgJyBCICcgMCAnIFMxICcgRjEgJyBldGMgICAgKGlmIEEgd2FzIHplcm8pCiMgICAgICAgICAgICAgICBeCiMgT1IgICAgICAgIDAgJyAwICcgQiAnIHMxICcgRjEgJyBldGMgICAgKGlmIEEgd2FzIG5vbnplcm8pCiMgICAgICAgICAgICAgICAgICAgXgoKIyBMZXQgQyA9IEIgb3IgMgojIEMgd2lsbCBiZSBndWFyYW50ZWVkIG5vbnplcm8gYW5kIHVuaXF1ZSBmcm9tIFMwIGFuZCBGMAo-Kys8WzxdPiAgIyBDcmVhdGUgQwpbLj4-XSAgIyBQcmludCAodXNpbmcgUyBvciBGOyBkb2VzIG5vdCBtYXR0ZXIpCgo-Wz4-XSAgIyBFbmQgb24gYSB6ZXJvIGNlbGxzIHdpdGggemVybyBjZWxscyBhbGwgdG8gdGhlIHJpZ2h0CiMgVGhpcyBpcyBuZWNlc3NhcnkgZm9yIHRoZSBjb21pbmcgZnVuY3Rpb25hbGl0eQojIGFsc28gYXMgdG8gbm90IGxvb3AKXSAgIyBFbmQgbm9uIG51bGwgYmxvY2sKCiMgTm93IHdlIGNvbnNpZGVyIGlmIG9uZSBvZiB0aGUgc3RyaW5ncyB3YXMgbnVsbAojIFRhcGU6ICAgIDAgJyBFMCAnIDAgJyBFMSAnIGV0YyAgICAoaWYgb25lIHN0cmluZyB3YXMgbnVsbCkKIyAgICAgICAgICBeCiMgVGFwZTogICAgMCAnICAwICcgMCAnICAwICcgZXRjICAgIChpZiBuZWl0aGVyIHN0cmluZyB3YXMgbnVsbCkKIyAgICAgICAgICBeCiMgV2hlcmUgRSBpcyBGIG9yIFMgKHdlIGRvbid0IGNhcmUpCgo-WyAgIyBFeGVjdXRlIG9ubHkgaWYgb25lIHN0cmluZyB3YXMgbnVsbAoKKyAgIyBMZXQgQSA9IEUwIChwbHVzKSAxCiMgQSBtYXkgb3IgbWFueSBub3QgYmUgemVybwojIFRhcGU6IDAgJyBBICcgMCAnIEUxICcgZXRjCiMgICAgICAgICAgIF4KCls-XStbPF0-ICAjIExldCBCID0gQSBvciAxCiMgQiBpcyBndWFyYW50ZWVkIG5vbnplcm8gYW5kICE9IEUwCiMgVGFwZTogMCAnIEIgJyA_ICcgRTEgJyAwICcgRTIgJyBldGMKIyAgICAgICAgICAgXgoKWy4-Pl0gICMgUHJpbnQKCiMgRW5kIG9uIHplcm8gY2VsbCBhcyBub3QgdG8gbG9vcApdICAjIEVuZCBudWxsIGJsb2Nr) (note that "dynamic memory" must be selected in the bottom-right)
Awesome challenge! I thought it would be trivial but it ended up being really difficult. I keep coming back to it because I feel like there *should* be some elegant 20-or-so-byte BF solution. At this point, I'm pretty happy I (seemingly) got it to work at all in BF.
Input is taken as `str1` + `\0` + `str2`, where strings are consecutive non-zero 1-byte characters.
Returns `(first str1 + first str2) or (first str1 + 1) or 2`. This algorithm was thought up by the brilliant @ØrjanJohansen, (presumably) based on my (broken) original one.
Commented:
```
# Let (Kn) be the nth character of K
# Let (^) designate the pointer
# Let F be the first string inputted
# Let S be the second string inputted
+>+[-  # Twice do
,[>>,]  # Input string (characters separated by 1)
<<[<<]>  # Go to left of beginning of string
]>  # End on first character of second string
# If second string is null we will end one too far to the left
>[>]<<<[<]>  # If first string is null we will end there too
# We will use this to do flow control
[  # Only run if both strings were non null
# Tape:    S0 ' F0 ' S1 ' F1 ' S2 ' F2 ' etc
#          ^
<+>>  # Let F0* = F0 (plus) 1  (is 1 as of now; F0 will be added later)
[-<+<+>>] # Let A = S0 (plus) F0
# A may or may not be zero
# F0* may or may not be zero
# Tape:    F0* ' A ' 0  ' S1 ' F1 ' etc
#                ^
[>]<[->+<]  # Let B = A or F0*
# B may or may not be zero
<[-]>>  # Clear F0*
# Tape:     0 ' B ' 0 ' S1 ' F1 ' etc    (if A was zero)
#               ^
# OR        0 ' 0 ' B ' s1 ' F1 ' etc    (if A was nonzero)
#                   ^
# Let C = B or 2
# C will be guaranteed nonzero and unique from S0 and F0
>++<[<]>  # Create C
[.>>]  # Print (using S or F; does not matter)
>[>>]  # End on a zero cells with zero cells all to the right
# This is necessary for the coming functionality
# also as to not loop
]  # End non null block
# Now we consider if one of the strings was null
# Tape:    0 ' E0 ' 0 ' E1 ' etc    (if one string was null)
#          ^
# Tape:    0 '  0 ' 0 '  0 ' etc    (if neither string was null)
#          ^
# Where E is F or S (we don't care)
>[  # Execute only if one string was null
+  # Let A = E0 (plus) 1
# A may or many not be zero
# Tape: 0 ' A ' 0 ' E1 ' etc
#           ^
[>]+[<]>  # Let B = A or 1
# B is guaranteed nonzero and != E0
# Tape: 0 ' B ' ? ' E1 ' 0 ' E2 ' etc
#           ^
[.>>]  # Print
# End on zero cell as not to loop
]  # End null block
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
żḟ@€ØAZḢ
```
**[Try it online!](https://tio.run/##AR4A4f9qZWxsef//xbzhuJ9A4oKsw5hBWuG4ov///0H/QUE "Jelly – Try It Online")**
### How?
```
żḟ@€ØAZḢ - Link: list of characters, a; list of characters, b
ż        - zip a and b
    ØA   - uppercase alphabet
 ḟ@€     - filter discard for €ach (swap @rguments)
      Z  - transpose the result
       Ḣ - head
```
[Answer]
# [Python 3](https://docs.python.org/3/), 62 47 57 54 51 bytes
**Edit:** - 5 bytes thanks to [@Mr.Xcoder](https://codegolf.stackexchange.com/users/59487/mr-xcoder)
**Edit:** +10 bytes to fix a bug
**Edit:** -3 bytes thanks to [@betaveros](https://codegolf.stackexchange.com/users/19857/betaveros)
**Edit:** -3 bytes by using max instead of pop
```
lambda x,y:max({*"abc"}-{x[:1],y[:1]})+max(x,y)[1:]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fYxvzPycxNyklUaFCp9IqN7FCo1pLKTEpWalWt7oi2sowVqcSRNZqaoPkgGo0ow2tYv8XFGXmlWjkaCgp6SgZFippav4HAA)
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 22 bytes
```
ＦＥα×ι⌈⟦ＬθＬη⟧¿¬№⟦θη⟧ιＰι
```
[Try it online!](https://tio.run/##LYkxDoMwDAD3vsKjI5kXdOxKmFgAMVgIGksJgZAgfu@C1JtOd5PjNEX2qktMgJY3ZIJWwnygEFi@JJSAQz2v3@xwNwR/dWY0NyALYBMzfmJZMw47gRsJ5Fm2@CxbkruLeat23avvtTq1OvwP "Charcoal – Try It Online") Link is to verbose version of code. Generates all strings of uppercase characters repeated to the length of the longer input and overprints all those that don't appear in the input. In other words, the output is normally `ZZZ...` unless that is one of the inputs, in which case it's `YYY...` unless that is the other input, in which case it's `XXX...`.
[Answer]
# Mathematica, 111 bytes
```
(c=Characters;a=#2;While[f=Alphabet[]~RandomChoice~Length@#;f==#||f==c@a]&[#&@@c@{##}~MaximalBy~Length];""<>f)&
```
  
[try it online](https://sandbox.open.wolframcloud.com/app/objects/) (paste code with ctrl+v, place input at the end and hit shift+enter) 
input
> 
> ["test","me"] 
> 
> 
> 
*thanx **@Not a tree** for checking and golfing -21 bytes*
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~38~~ 30 bytes
```
{(1 x.max.comb...*∉$_).tail}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwv1rDUKFCLzexQi85PzdJT09P61FHp0q8pl5JYmZO7f/ixEqFNI1oJUNDQyUdIGmkFKtpzQUTtQSKWRgYoIgp6SgolaQWl6AIggWAEmDB/wA "Perl 6 – Try It Online")
Anonymous codeblock that takes input as a list of two strings, and returns the first number from `1111...` with a non-empty amount of 1s that isn't in the input.
### Explanation:
```
{                          }   # Anonymous code block
  1 x.max.comb                 # String multiply 1 by the size of the non-empty string
              ...              # Create a sequence increasing by 1
                 *∉$_          # Until the number is not in the input
 (                   ).tail    # And take the last number
```
[Answer]
# [Zsh](https://www.zsh.org/), ~~51~~ ~~47~~ ~~37~~ 36 bytes
***-4** bytes by using builtin array `argv`, **-10** bytes by using prefix removal and `RC_EXPAND_PARAM`, **-1** byte by inlining the brace expansion.*
```
<<<${${${:-{1..3}${^@#?}}:|argv}[1]}
```
[Try it online!](https://tio.run/##LcjRCoIwGIbh813Fhwn/kcLqzAZ1H1Gw2l8OxiZOFFy79qUQ78nLs8a@LL11jJG1gbOezzBB8KwdIk9oGlT1zlVRStVpr2uSbNtTrtPjerjk3H31@JnzTd5zMcFzkTgKIkghQSToHQKeeiT8b92MvYkANlvs1CMO@sUbkPgB "Zsh – Try It Online")
First, this was an awesome challenge, I went through a ton of ideas before landing on this one.
```
<<<${${${:-{1..3}${^@#?}}:|argv}[1]}
       ${:-             }            # empty fallback
                 ${ @#?}             # remove first character from each parameter
                 ${^@  }             # enable brace expansion (set -P)
           {1..3}${^@#?}             # expand to 1foo 2foo 3foo 1bar 2bar 3bar
     ${                  :|argv}     # Set difference with 'argv'
   ${                           [1]} # The first found element
<<<                                  # print to stdout
```
`@` and `*` are not identifiers, so `${ :|@}` and `${ :|*}` don't work, hence the use of `${ :|argv}`
> 
> This method will work up to 93 inputs and find a 94th which is unique. Simply replace the `{1..3}` with the maximum possible range `{~..!}`.
> 
> 
> 
# [Zsh](https://www.zsh.org/), ~~48~~ 47 bytes\*
```
for ((;$#i<${#${1:-$2}}||$@[(I)$i];i++)):
<<<$i
```
[Try it online!](https://tio.run/##qyrO@P8/Lb9IQUPDWkU500alWlml2tBKV8WotramRsUhWsNTUyUz1jpTW1tT04rLxsZGJfM/EBgaAAA "Zsh – Try It Online")
Completely new method courtesy of JoKing's Perl 6 submission, but doesn't work on large strings (n>20) due to integer size restrictions. `$@[(I)$i]` is reverse array lookup to largest index, it will output zero (falsy in arithmetic expansion) if $i is not found in the command line parameters.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~8~~ 7 bytes
```
øvAyм¬?
```
Uses the **05AB1E** encoding. [Try it online!](https://tio.run/##MzBNTDJM/f//8I4yx8oLew6tsf//Pzk/JZUrPT8nDQA "05AB1E – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 12 bytes
```
c"1Y2@X-1)&h
```
Input is a cell array of strings containing printable ASCII chars. The output is formed from the letters `'ABC'`, and so belongs to the input domain.
[Try it online!](https://tio.run/##y00syfn/P1nJMNLIIULXUFMt4///avXEpGR1HQV1RydnF1f1WgA "MATL – Try It Online")
### Explanation
The output is as long as the longest input string. Its *n*-th character is the first letter from `'ABC'` that is different from the *n*-th character of both input strings.
```
c        % Concatenate the two strings vertically. If one is shorter it is
         % right-padded with spaces. Gives a 2-row character matrix
"        % For each column
  1Y2    %   Push the string 'ABC...Z' (the upper-case letters)
  @      %   Push current column
  X-     %   Set difference
  1)     %   Get first character
  &h     %   Horizontally concatenate the results so far
         % End (implicit). Display stack (implicit)
```
[Answer]
## Haskell, ~~56~~ ~~52~~ 48 bytes
```
x#y|_:t<-max x y=[c:t|c<-"abc",c:t/=x,c:t/=y]!!0
```
[Try it online!](https://tio.run/##VYy9DsIgFIV3n@L2doGEqnNT3kAnx6ZpAGs0FtIgJJD03RHRDi7n58vJuYvXc5rnlEId17F1XaNFgACR96p1q@oaFFIhy@XAw9fiUFXHpMXDAActlvMIZPHu4uzJ7L1R3tpIakqh3wEAQTHdkOE1K2U/8rlEmXUjyLIV/r/BnDciCykbGNIb "Haskell – Try It Online")
Replace the first char of the maximum of the two input strings with `a`, `b`and `c` and pick the first one that is different from both input strings.
[Answer]
# [Ruby](https://www.ruby-lang.org/), 53 bytes
```
->a,b{([?a,?b,?c].map{|e|e*[a,b].max.size}-[a,b])[0]}
```
[Try it online!](https://tio.run/##bcxLCoMwEAbgvacIKlRLlPYArQexLhKdgFAfmAi16tltxidqZ5HM/80wVc2bwRaP1@A9GeWtEwaMBpwGceRnrGw76OAa6gnGjy/TL/TemN3wFvVDAoIokMrR5BpEV1krSUwRWi3z01yWEKueEqvla4rIQ2dbTGcXNQ3IE8PAY8TE16TzP1tSoCRFflmpASIRG5AbHSVjDQc03dSwqGBvOerUHFVV2yrDQpyaf3pCjrXoHWVdGce7FO/SeoyfN5cw7Q0/ "Ruby – Try It Online")
Basically generates the strings `a...a`, `b...b`, and `c...c` and selects the first not in the input.
[Answer]
# ES6, 54 bytes
```
a=>b=>(a[0]+b[0]|0?'a':9-(a[0]^b[0]))+(a||b).substr(1)
```
[Answer]
# Pyth, 7 ~~8~~ bytes
```
hC-LG.T
```
*1 byte thanks to Jakube*
[Test suite](https://pyth.herokuapp.com/?code=hC-LG.T&input=%22test%22%2C+%22test%22+-%3E+%22tttt%22%0A%22do%22%2C+%22don%27t%22+-%3E+%22dnut_%22%0A%22ye+s%22%2C+%22yes%22+-%3E+%22fals%22%0A%22yes%22%2C+%22yes%22+-%3E+%22noo%22%0A%22maybe%22%2C+%22mayue%22+-%3E+%22false%22%0A%22false%22%2C+%22false%22+-%3E+%22truee%22%0A%22false%22%2C+%22true%22+-%3E+%22fatr%22%0A%221%22%2C+%22%22+-%3E+%220%22&test_suite=1&test_suite_input=%22test%22%2C+%22test%22+%0A%22do%22%2C+%22don%27t%22+%0A%22ye+s%22%2C+%22yes%22+%0A%22yes%22%2C+%22yes%22+%0A%22maybe%22%2C+%22mayue%22+%0A%22false%22%2C+%22false%22+%0A%22false%22%2C+%22true%22+%0A%221%22%2C+%22%22+%0A%22abcdefghijklmnopqrstuvwxyz%22%2C+%22aaaaaaaaaaaaaaaaaaaaaaaaaa%22&debug=0)
We use `.T`, length preserving transpose, rather than `C`, truncating transpose, so that it works on inputs where one string is empty.
Given two strings as a tuple, we transpose them (`.T`), then map the resulting pair of characters or single character by subtracting the character(s) from the lowerase alphabet with `-LG`, then transpose the resulting list of strings of unused characters with `C`, then return the first such string with `h`. This consists of the first letter alphabetically that is not in either string, for each position.
[Answer]
# [Java (OpenJDK 8)](http://openjdk.java.net/), ~~100~~ 73 bytes
-27 bytes thanks to @Nevay's magical touch! :)
```
a->b->{b=b.length<1?a:b;if(a.length<1||(b[0]^=2)==a[0])b[0]^=1;return b;}
```
[Try it online!](https://tio.run/##ZZJRb4IwEMef56e4kJjBosTCmwjLsmRve9qjuqRoURy2pC0uRPnsrrXo3I2kubvfXf@9cLejBzoWNeO79de53NdCatgZFja6rMKi4StdCh4@JYO6yatyBauKKgXvtORwHAD0VGmqjTmIcg17k/M/tCz5Zr4EKjcquJQCvPVys9WWyvlyhGNnsgyK9EzHWT7OjnmahxXjG72dkWc6zZOy8OmNnE5@Pp8sP9MoSFNqvMCFJJFMN5JDnnTn5PL2tSHTkmZKK0hNUw9HzwbeCJztRhathQVrwR@vpGWgLGuZuhEE9rTNmUXGaVgPC1qpC3QOglq6Qrh8R49YeA9sTO7BxBuZg8C/igiDGL3yV4NgDYI1CNaIsEaENSKsEWGNGGvEWCPGGvG9RufmWgj5u2x2iFM33@vOmcm3SrN9KBod1qZOF7638IZqYf6uszDOem/IDbTXzRb1DjEOZ9/9/vhFSOu6av2@KNTi1Szti5S09YPgPklwMghcx93Anu78Aw "Java (OpenJDK 8) – Try It Online")
Input domain = Printable ASCII + codepoint 127.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 11 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
Full program, takes input as a 2-element nested list.
```
⊃¨⎕A∘~¨,⌿↑⎕
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKNdIe3/o67mQyse9U11fNQxo@7QCp1HPfsftU0ECoDk/3OmcWmoOzo5q2tqqLu4uqlrcoFFUvJBAin5eerqJTAxR5AQjANiAwUA "APL (Dyalog Unicode) – Try It Online")
[Answer]
# Ruby, 56 bytes
```
->a,b{a,b=b,a if a<b;a[0]=([?a,?b,?c]-[a[0],b[0]])[0];a}
```
[Answer]
# [Pyth](https://pyth.readthedocs.io), 23 22 bytes
```
+.)-.{<G3.{,<Q1<KE1t|K
```
**[Try it here!](https://pyth.herokuapp.com/?code=%2B.%29-.%7B%3CG3.%7B%2C%3CQ1%3CKE1t%7CK&input=%22abc%22%0A%22abd%22&test_suite=1&test_suite_input=%22test%22%0A%22test%22%0A%0A%22do%22%0A%22don%27t%22%0A%0A%22ye+s%22%0A%22yes%22%0A%0A%22yes%22%0A%22yes%22%0A%0A%22maybe%22%0A%22mayue%22%0A%0A%22false%22%0A%22false%22%0A%0A%22false%22%0A%22true%22%0A%0A%221%22%0A%22%22%0A&debug=0&input_size=3)**
# [Pyth](https://pyth.readthedocs.io), 22 bytes
```
+eS-.{<G3.{,<Q1<KE1t|K
```
**[Test Suite!](https://pyth.herokuapp.com/?code=%2BeS-.%7B%3CG3.%7B%2C%3CQ1%3CKE1t%7CK&input=%22abc%22%0A%22abd%22&test_suite=1&test_suite_input=%22test%22%0A%22test%22%0A%0A%22do%22%0A%22don%27t%22%0A%0A%22ye+s%22%0A%22yes%22%0A%0A%22yes%22%0A%22yes%22%0A%0A%22maybe%22%0A%22mayue%22%0A%0A%22false%22%0A%22false%22%0A%0A%22false%22%0A%22true%22%0A%0A%221%22%0A%22%22%0A&debug=0&input_size=3)**
---
# Explanation
```
+.)-.{<G3.{,<Q1<KE1t|K  - Full program.
      <G3               - Yields the String "abc"; Alphabet[:3].
    .{                  - Set formed by the above.
         .{,<Q1<KE1     - Set formed by input_1[:1] and input_2[:1]
   -                    - Set subtraction.
 .)                     - Pop the last element.
+                       - Append.
                   t|K  - input_1[1:] or input_2[1:], relying on the result of Logical OR.
```
[Answer]
# Perl 5, ~~82~~ 79 bytes
```
sub{$_=$_[0];$_=$_[1]||$_ if/^(xz*)?$/;s/[^z]/z/||s/./y/;$_ eq$_[1]&&s/./x/;$_}
```
Takes input as two separate arguments and returns the third string.
The subroutine attempts to produce a string very similar to the first string but with the first non-`z` character replaced with a `z`. Then it deals with corner cases by replacing the first character with `y` or `x`, as needed, if it finds that one of the inputs was in fact a sequence of all `z`'s.
[Answer]
# [Perl 5](https://www.perl.org/), 68 bytes
```
sub{$_="a"x length $_[0]||$_[1];$_++while $_ eq$_[0]||$_ eq$_[1];$_}
```
Explanation:
* starts with (string of letter "a" as long as first string) or second string if that is false i.e. zero-length
* keeps incrementing that until it's different from both first and second
Starting from "a"s was to avoid incrementing to point where Perl lengthens the string; with only two strings to avoid being same as, it couldn't overflow.
Execute with:
```
perl -e '$s = ' -E 'sub{$_="a"x length $_[0]||$_[1];$_++while $_ eq$_[0]||$_ eq$_[1];$_}' -E ';say $s->("z", "true")'
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~70~~ ~~65~~ ~~73~~ ~~67~~ 61 bytes
The function needs the provided strings to be mutable (i.e. either arrays or dynamically allocated).
```
f(a,b)char*a,*b;{a=*a?a:b;*a=*a>70?33:99;*a+=*a==*b;puts(a);}
```
[Try it online!](https://tio.run/##nY1BbsIwEEX3PsXIG@I0lahYVMEKHKTqYuzYkJbEqe3Quoizpw5CqmpRgfDK/81/M/JxI@U46gwLweQWbY5FLvgBqxzXuBQ8n36r5/l6sViWZYwPMVdV7PSDdxkyfhybzkOLTZftTVMzOJBpEWhjXsryFSqgXjlPCxBo/xBOAHQWe6cR4yRm563swwnS2lBWnEEsTKCbecp@vYtaUOASMSh3g3aP1WIQKvEiG9RVU@POpeaZ3WF6e8PJp0S6KqCQtdKbbfP2vms7039Y54f951f4Tjbhv@/iDav8YDuYc3Ik4w8 "C (gcc) – Try It Online")
Works for the standard ASCII range
Explanation:
```
a=*a?a:b           // If a is empty, point to b instead
*a=*a>70?33:99     // Choose a different value for the 1st character of a,
                   // while giving enough space to increment it without 
                   // going back to its previous value
*a+=*a==*b         // Increment the 1st character of a if the arbitrary
                   // chosen value is equal to the value of the 1st 
                   // character of b
puts(a)            // Outputs a
```
[Answer]
# R, ~~89~~ 67 bytes
*@Giuseppe saved 9 bytes, @user2390246 saved 13 bytes*
### function
```
function(x,y)sub("^.",letters[!letters%in%substr(c(x,y),1,1)][1],x)
```
### demo
```
# define function
f <- function(x,y)sub("^.",letters[!letters%in%substr(c(x,y),1,1)][1],x)
# test cases
f("test","test")
[1] "aest"
f("do","don't")
[1] "ao"
f("ye s","yes")
[1] "ae s"
f("maybe","mayue")
[1] "aaybe"
f("false","false")
[1] "aalse"
f("false","true")
[1] "aalse"
f("1","")
[1] "a"
f("art","bug")
[1] "crt"
```
[Answer]
# Java 8, 119 bytes
Lambda (curried) from `String` to lambda from `String` to `String`. Assign to `Function<String, Function<String, String>>`.
```
s->t->{String r=s.length()>t.length()?s:t;while((s+t).contains(r))r=r.substring(1)+(char)(Math.random()*128);return r;}
```
[Try It Online](https://tio.run/##jVJNj9owED1nf8U0EpJdwIJeWm02VFXV3va0x10OJhhimjjUMwEhNr@djmOCqHqpZMnPz/Px5mOnD3ra7I3brX9d9u2qsgUUlUaEZ20dnB@SvbcHTQaQNPHnjh1US7ZSm9YVZBunfl7B0wt567aT/7KJ92IBVFq/ji/ILzhd0HRxvr59jqoybkulkAu6wa/4SNmxtJURAsckVdE4YrkovJQ@9wrbFfYRxFyORVFqL8WzplJ57dZNLeTH@acvMvOGWu/AZ90lyR641Fj/tdJDY9dQc1gR1bwuQfstytCUZKCYLDQahBycOcIdHaySc0oGKZ1AvLtJJGt9WpnAMmjNjX5rZ7PPPd@jTfzogrRk03i4E/Kdk8JjzB0VJS8nJFOrpiXFM3NUDcIV@9aaRDrCCYyQ3UbISfoYr7PlgOaM7oah9H5fncRgJf96z5dSyiyIu2kLXYaC@zDL@HoC7nAA4xzmg8A4VF6r@2aJAINz6FnR9VEHU66Fbf8VZd0gJ02jg92ACJUPKwIfOC@8v4cQyvxudYXB66okodI3x17EN0Tjw2b@8L7xIkbr@sr4dJc/)
## Ungolfed lambda
```
s ->
    t -> {
        String r = s.length() > t.length() ? s : t;
        while ((s + t).contains(r))
            r = r.substring(1) + (char) (Math.random() * 128);
        return r;
    }
```
This solution rotates random ASCII characters into the longer string until the required conditions are satisfied. Inputs are UTF-8 and outputs are ASCII.
I don't know the gritty details of Unicode, but it seems plausible to me that this solution could fail when an appended `char` joins the preceding code point to form a single code unit. If someone who knows more about this can verify this, I'll change the input domain to ASCII.
# Java 8, 126 bytes
Same type as above.
```
s->t->{String r;for(byte[]o=(s.length()>t.length()?s:t).getBytes();(s+t).contains(r=new String(o));o[0]%=128)o[0]++;return r;}
```
[Try It Online](https://tio.run/##jVJNj9owED1nf8U0EpIjwIJeWm02qdqqvfW0R5aDCQZMg009E1aIzW@n4zihVL1UiuTnl/l48zx7dVJTd9R2v/55PTar2lRQ1QoRfihj4fKQHL05KdKApIh/7jlBNmRquWlsRcZZ@b0HT8/kjd1O/ismnmUJtDN@HW9QXHFa0rS89Hefb5wXqzPpxdIVAmWt7ZZ2IivpBj/hI2Vyq@kLh6HIcoFjJipniSdA4QurX/t2wmVZ7haz5aiYv/@YBTQe515T4y03a69J/sATRxv6gU/OrOHApUSssViC8lvMgjfJQDFZKdQIBfzp1tEhKrmkLI3SCcSznUTyoM4rHVgGjb7RL81s9qHjO7SJP9ogLWE/4E7IV24Kj7F3VJQ8n5H0QbqGJD@dpXoQLjn3oEikI5zACDlthNykq8FGDGjO6O5NpDoe67MYorK/7vNlxoYGcTdt1U55qNiHWc7HE7DPAYwLmA8C49vydt2bJQIMycGzqu2qDqE8C8f@K8rYQU6axgSzAREmH5YD3nFfeHsLJaT@1agaQ1avJKGdd6@diM@I2ocF/eY9r1ys1naT8ddefwM)
## Ungolfed lambda
```
s ->
    t -> {
        String r;
        for (
            byte[] o = (s.length() > t.length() ? s : t).getBytes();
            (s + t).contains(r = new String(o));
            o[0] %= 128
        )
            o[0]++;
        return r;
    }
```
This increments the first byte of the longer string, wrapping within ASCII, until the required conditions are met. Inputs and outputs are ASCII strings.
[Answer]
# Bash, ~~115~~ .. 77 bytes
Replaces first char of the first (non-empty) input string with 1,2,3 until no match is found to either input. [Try it Online!](https://tio.run/##dYxBDoIwEEX3PcVPbTK6wKSww5h4D@MC6JgSsRCLigHOjkVjogtn@d@bl2feTndbVowLZwZV6XgDUwu@ZRU8t4giSDXPcuq2UvU6jVQ8SnGsL/AoHXq9XidjIF2qw95jv4fy2GK3VHpQ8QqHwzDkIX/ajIILW4egl9PVzflujghTO56IQHxu2gfh@xYg/VoFsTMeCNq9bC18kxXs6SW8gfj809@EDjD@pW8hIfEE)
***-9, -12, -9, -8*** bytes all thanks to [GammaFunction](https://codegolf.stackexchange.com/users/86147/gammafunction)
```
x="${1:-$2}"
for s in {1..3}"${x:1}"
{ [[ $s = @($1|$2) ]]||break;}
echo "$s"
```
(quite an improvement over the [original...](https://gist.github.com/roblogic/c856c9607b5d29ff856d1c45c8807a75))
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 10 bytes
```
∋l~lℕṫ.&≡ⁿ
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//1FHd05dzqOWqQ93rtZTe9S58FHj/v//o5UMDZR0FICkgVLs/wgA "Brachylog – Try It Online")
### Explanation
There may be a better way to do this, but I've been fighting Brachylog strings for a while now and this solution works.
```
∋           For some element of the input list
 l          get its length
  ~l        That is also the length of
    ℕ       some positive integer
     ṫ      Converting that integer to a string
      .     is the output
       &    Also:
         ⁿ  It is not true, for any X in the input list
        ≡   that the output equals X
```
Outputs strings like `"100"`. If `"100"` is already in the input list, goes to `"101"`, etc.
[Answer]
# [Perl 5](https://www.perl.org/), 79 + 1 (-p) = 80 bytes
```
$"=<>;chop;$_=length($,=$_)>length$"?$_:$";s/./chr$&+65+$i++/e while/^($"|$,)$/
```
[Try it online!](https://tio.run/##JcexCoMwFAXQ3a8o4VKU2L7JDo1R7Ic0gzyaQDDBBFz67X0dPNvJvMdBBMqOk1l9ygbORt4@1bfoLVw3nYOa4Z5QptCdVr/jqh@DRtCa@HL4EJneLdQXfQcSeZXaLFzqL@Ua0lbklv8 "Perl 5 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 17 bytes
```
;B¬£ñl g1 çXÃkU v
```
Repeats the letters `A-Z` to the length of the longer input, removes the values in the input, and get the first item in the array.
[Try it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=O0Kso/FsIGcxIOdYw2tVIHY=&input=WyJhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiIsICJBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQSJdCi1R)
## Old solution, 18 bytes
```
;@!UøX}a@ñl g1 çBö
```
[Try it online!](http://ethproductions.github.io/japt/?v=1.4.5&code=O0AhVfhYfWFA8WwgZzEg50L2&input=WyJCIiwgIiJdCi1R)
Chooses a random character from the alphabet and repeats it to the length of the longer input string, until it is not present in the input.
[Answer]
# Python 3, 74 73 bytes
-1 byte thanks to Step Hen
```
def f(x,y,i=1):
 while i*10<10**len(x or y)or str(i)in x+y:i*=2
 print(i)
```
Prints lowest integer with the same length as the first of the inputs that has nonzero length.
[Answer]
# Python 2, 77 bytes
```
a=input()
b=ord(a[0][0])+1
if b==ord(a[1][0]):b+=1
print unichr(b)+a[0][1:-1]
```
I think it has some potential. The idea is that it adds 1 to the 1st char in the 1st string, then checks if the other input's 1st char is the same.
\*\*Note, ^ doesn't handle 0 length strings, so it doesn't really work at this length. 
Here's a super long solution that works with 0 length
# 146 Bytes
```
a=input()
def c(i):print unichr(ord(a[i][0])+1)+a[i][1:];exit();
for x in range(2):if len(a[x-1])<1:c(x)
if a[0]==a[1]:c(1)
print a[1][0]+a[0][1:]
```
Any improvements would be appreciated!
[Answer]
# CJam, ~~31~~ ~~30~~ 23 bytes
```
q~:A:e>,3,sf*{A\f=:+!}=
```
Takes printable ASCII as input. Outputs either a string of 0's, 1's, or 2's that is the same length as one of the input strings. The logic is that one of those can't be either of the input strings!
[Try it Online](http://cjam.aditsu.net/#code=q~%3AA%3Ae%3E%2C3%2Csf*%7BA%5Cf%3D%3A%2B!%7D%3D&input=%5B%22000%22%20%22111%22%5D)
```
q~:A    e# Store input array as var 'A'
:e>,    e# Take the length of the lexicographically greater string in the input array
3,s     e# Generate "012"
f*      e# Repeat each number as many times as the longer string length, yielding something like ["000","111","222"]
{       e# Search array of number strings for first that returns true for this function
A\f=    e# Map each string in the input array to whether it equals the current number string (0,1)
:+!     e# Add up the array of bits and take the logical not. This returns true iff both array values were not equal to the current number string.
}=      e# Return the first number string that returns true.
```
]