Lonely Multiplication Based on this question from Code Review.

Given precisely three positive integers, return the product of all of the distinct inputs. If none of the inputs are distinct, return 1. That is, implement the function:

\$ f(a,b,c) = \cases{1 &amp; $a = b = c $ \\ a &amp; $ b = c $ \\ b &amp; $ a = c $ \\ c &amp; $ a = b $ \\ a b c &amp; otherwise } \$

Shortest code in each language wins.

Test cases

a, b, c -&gt; f(a,b,c)
7, 7, 7 -&gt; 1
3, 3, 5 -&gt; 5
2, 6, 6 -&gt; 2
3, 4, 3 -&gt; 4
1, 2, 3 -&gt; 6
12, 9, 16 -&gt; 1728
05AB1E, 3 bytes

¢ÏP


Try it online!

¢       # count occurences of each number
 Ï      # keep only those where the count is 1
  P     # product (1 if the list is empty)