g | x | w | all
Bytes Lang Time Link
042AWK241113T164812Zxrs
042Tcl181007T034711Zsergiol
012Jalapeño250212T035507ZATaco
021Desmos250205T051015ZDesmosEn
024CASIO BASIC CASIO fx9750GIII241120T181800Zmadeforl
00605AB1E181006T201927ZKevin Cr
086C gcc230703T093139Zl4m2
053JavaScript Node.js230703T082715Zl4m2
009TIBASIC230701T043010ZTiKevin8
003Jelly230701T032426ZUnrelate
005Thunno 2230630T162315ZThe Thon
005Vyxal221122T061441Zemanresu
036Gol><>190302T040528ZKrystosT
049PowerShell190301T133741Zmazzy
117Java JDK190301T220009ZSara J
036Bash190301T225811ZJoshua D
044Python 3.8 prerelease190301T121739Zsquid
022Perl 6181017T152017ZVen
012APL Dyalog Unicode181029T140816ZAdalynn
079Scala181017T130216Zjrook
006APL Dyalog Classic181011T081127Zngn
032Ruby181016T073005ZG B
057PHP181016T015102ZTitus
013Pip181015T230906ZDLosc
008Japt hF181015T163231ZOliver
4953JavaScript Node.js181005T213441ZChris M
037R181005T212558ZRobert S
022V181008T132409Zoktupol
012APL Dyalog Unicode181009T212907ZAdá
009MATL181008T145247ZSundar R
054Perl 5 n M5.010181008T152407ZSundar R
038Ruby aplF181008T124028ZKirill L
238Java JDK181008T070333ZJaden Le
039Ruby181007T132256ZiBug
112F#181007T225354ZCiaran_M
128Rust181007T214640ZHannes K
101Java JDK181007T154544ZLucy Ste
004Jelly181006T105847ZJonathan
028Bash coreutils181007T132736ZiBug
081Red181006T002414ZDick Bry
074PHP <=5.6181005T230958ZArtistic
009Actually181007T033230Zuser4594
039Runic Enchantments181007T023421ZDraco18s
007Pyth181006T003405Zhakr14
035K4181005T214950ZThaufeki
022Perl 6181005T213617ZJo King
054XPath 3.1181006T224931ZMichael
061Haskell181006T000015ZLaikoni
041Python 2181005T221256ZArnav Bo
091C gcc181006T165541Zuser7740
102Common Lisp181006T131752ZRenzo
016Japt181005T222737ZShaggy
043Mathematica181006T100534ZLegionMa
005MathGolf181006T074242Zmaxb
037Python 2181006T080849Zovs
015Charcoal181006T010044ZNeil
028Octave181005T215241Zflawr
009Ohm v2181005T214912ZThePlasm
044Python 2181005T214651ZChas Bro
004Neim181005T212306ZOkx
013CJam181005T210256ZEsolangi

AWK, 51 42 bytes

{for(;i++<NF;x+=$i!=$1)$i>y&&y=$i}$0=x?y:0

Attempt This Online!

Buggy:

{for(;i++<NF;x+=$i~$NF?1:0)y=$i>y?$i:y;$0=1~x?y:X}1

To test:

awk -F"," '{for(;i++<NF;x+=$i~$NF?1:0)y=$i>y?$i:y;$0=1~x?y:X}1' <<< "7,3,8,4,8,3,9,4,6,1,3,7,5"

{for(;i++<NF;   # iterate through numbers
x+=$i~$NF?1:0)  # count duplicates
y=$i>y?$i:y;    # if new number is bigger
$0=             # set output
1~x?y:X}1       # only one match or blank

Tcl, 42 bytes

proc M t {expr max($t)-min($t)?max($t):""}

Try it online!

Jalapeño, 12 bytes

SU₋'↦N{₄⇊,⇈u⇪1

Explained

SU₋'↦N{₄⇊,⇈u⇪1
S                # Splitby
 U₋'             # The literal character 0x2C ("," or "U₋" in Jalapeño encoding)
    ↦N          # Mapby tonumber
       {₄        # Applied to the subchain
         ⇊,⇈    # The list consisting of the minimum followed by the maximum of the input
             u   # Keeping only unique elements
              ⇪1 # Take the element at index 1. The max if it's different then the min, or undefiend otherwise.

Hex-Dump of Bytecode

       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0000: 13 2c 21 d0 43 c8 f2 29 f0 e4 e0 31             

Try it Online!

Jalapeño, 6 bytes, Standard IO

⇊,⇈u⇪1

Same as above but without the extra work to fix the input

Hex-Dump of Bytecode

       0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0000: f2 29 f0 e4 e0 31                               

Try it Online!

Desmos, 21 bytes

f(l)=v/vl.max
v=l.var

It checks if all elements are identical by calculating the variance, and if it's 0, it leads to a divide by 0 error, otherwise it returns the max.

-4 bytes thanks to Aiden Chow

Try it on Desmos!

CASIO BASIC (CASIO fx-9750GIII), 40 24 bytes

(edit: how in the world did i forget the byte count? sorry about that!)

?→List1
Max(List1
" "
Ans≠List1[1⇒Ans

you have to put a { before your input.

I love implicit output

05AB1E, 9 8 6 bytes

',¡ê¦à

-1 byte thanks to @Cowabunghole.

Try it online or verify all test cases.

Would be just the last 3 bytes (ê¦à) if a list input would be allowed:
Try it online or verify all test cases.

Explanation:

',¡    '# Split the (implicit) input-string by ","
   ê    # Uniquify and sort the list
    ¦   # Remove the first item
     à  # Pop and push the maximum, or an empty string if the list is empty
        # (which is output implicitly as result)

C (gcc), 86 bytes

a;g(){scanf("%d,",&a);}f(b,c){for(b=g(),c=a;~g();c=a>c?a:c)b&=a==c;b||printf("%d",c);}

Try it online!

Read stdin and write stdout

JavaScript (Node.js), 53 bytes

s=>(s=s.split`,`.sort((a,b)=>a-b))[0]-s.pop()?s[0]:''

Try it online!

Worse than Shaggy's

TI-BASIC, 11 9 bytes

9 Bytes

If max(Ans≠max(Ans
max(Ans

Shaved 2 more bytes - implicit Disp on the final line and optimizing the condition. We instead get a single value from the input list in Ans with max( and check if it is not equal to all the other values of the list with Ans≠max(Ans. We then check if at least one of the elements in the list was different with another max( command. Ultimately this is the same number of tokens in the condition but it saves a byte by eliminating the 2 byte ΔList( command.

11 Bytes

If sum(0≠ΔList(Ans
Disp max(Ans

Takes an input list in Ans. The ΔList( command returns a list of the differences of the elements in the provided list. In TI-BASIC logic performed on lists returns a list with the operation performed on each element in that list, so 0≠ returns a list of 1s and 0s identifying if diffs of consecutive elements were 0 and therefore the elements were equal. By summing this list we identify whether all all elements were different to the next and therefore whether they were all different (we would need to sort the list first if trying to identify the number of different elements, but since we only care about whether they're all the same there's no need to sort). That whole chunk is used as the condition for whether to display the max of the input list in Ans. 11 bytes because the ΔList( command is a 2 byte token.

Jelly, 3 bytes

ṀḟṂ

Try it online!

TIO link uses function I/O for the sake of having a test harness, but it works just fine with a plain comma-separated list. I'd prefer to let a challenge like this stay dead, but if it's been bumped anyways...

Ṁ      The maximum,
 ḟ     unless it's equal to
  Ṃ    the minimum.

Thunno 2, 5 bytes

G$ạ?"

Attempt This Online!

Explanation

G$ạ?"  "# Implicit input
G       # Push the maximum
 $      # Push the input again
  ạ     # Is it all equal?
   ?    # If it is:
    "  "#  Push an empty string
        # Implicit output

Vyxal, 5 bytes

≈[¤|G

Try it Online!

≈[    # If all same 
  ¤   # ""
   |G # Else max

Gol><>, 36 bytes

TIE!tlK1}l4,MF={=}|{?;1W~2K(?$~lM|~h

4 bytes golfed off!!! I realized I was using some redundancies in there... next I think I can really make the part for checking if the array is equal smaller!

Try it online!

# Gol><>, 40 bytes

TIE!tlK1}l4,MF={S&}|{?;1W~2K(Q$~:|~lM|~h

Haha, I had my debug stuff in my previous answer, now this has golfed off 2 bytes, but I just realized how to make it even shorter

Try it online!

PowerShell, 45 49 bytes

+4 bytes thanks Veskah

($l=$args-split','|sort{+$_}-u)[-1]|?{$l.count-1}

Try it online!

Less golfed:

$list=$args-split','|sort{+$_}-unuqie
$max=$list[-1]
$max|?{$list.count-1}

Java (JDK), 112 108 117 bytes

s->{return java.util.Arrays.stream(s.split(",")).mapToLong(Long::new).distinct().sorted().skip(1).max().getAsLong();}

Try it online!

Either returns a long or throws an exception, which presumably counts as not returning anything.

Edit: Fixed a bug that caused incorrect output if the maximum was the first element of the input. (+9 bytes)

Bash, 36 bytes

tr , \\n|sort -un|tail -n+2|tail -n1

takes input on stdin, outputs to stdout

$ echo 1,2,3 | ./f.sh
3
$ echo 1,1,1 | ./f.sh
$ echo 123,231,321,312 | ./f.sh
321

Python 3.8 (pre-release), 45 44 bytes

if~-len(a:=set(eval(input()))):print(max(a))

Try it online!

First time golfing; I'm sure this can be improved.
Also a few months late to the party on this challenge, but whatever. xD

Perl 6, 28 22 bytes

{.max x![==] $_}o&EVAL

Try it online!

-6 bytes thanks to @ASCII-only

APL (Dyalog Unicode), 12 bytes

(⌈/↑⍨⍬≢1↓∪)⎕

Try it online!

If there were no input requirements, it could just be ⌈/↑⍨⍬≢1↓∪ for 9 bytes.

Scala (91 79 bytes):

def f(s:String){val i=s.split(",");if(i.toSet.size>1)print(i.map(_.toInt).max)}

Try it online

APL (Dyalog Classic), 6 bytes

⍪⌈/~⌊/

Try it online!

a train computing the maximum (⌈/) without (~) the minium (⌊/) turned into a matrix ()

if the input contains only one distinct element, ⌈/~⌊/ will be empty and will return a 0×1 matrix which renders as nothing

otherwise, ⌈/~⌊/ will be a 1-element vector and its will be a 1x1 matrix (visually indistinguishable from a scalar) that contains the maximum

Ruby, 32 bytes

->l{eval(l).minmax.uniq[1,1]*''}

Try it online!

PHP, 57 bytes

<?=count(array_unique($a=split(",",$argn)))>1?max($a):"";

requires PHP<7; replace split with explode for current PHP (+2 bytes):

<?=count(array_unique($a=explode(",",$argn)))>1?max($a):"";

Run as pipe with -nR or try them online.

Pip, 13 bytes

a^:',MXaRMMNa

Try it online!

Uses the approach from ngn's APL solution:

     MNa  Minimum of the list
  aRM     Remove it from the list
MX        Take the max of the remaining elements

The first 5 bytes a^:', split the input string on commas.

Alternate 13-byte solutions:

I!$=Ya^',PMXy
a^:',$=a?uMXa

Japt -hF, 8 bytes

q, ün Åc

Try it

-3 bytes if the input could be taken as an array.

JavaScript (Node.js), 49/53 bytes

My original version using .every(), 53 bytes

Does a function returning '' count as no output? Sure this can be improved upon...

s=>(a=s.split`,`).every(e=>a[0]==e)?'':Math.max(...a)

Try it online!


Improved version using Set() by Shaggy, 49 bytes

s=>new Set(a=s.split`,`).size>1?Math.max(...a):``

Try it online!

R, 50 37 bytes

-33 bytes thanks to digEmAll! -13 bytes thanks to rturnbull!

x=scan(se=",");if(any(diff(x)))max(x)

Try it online!

V, 22 bytes

Ó,/ò
ún
Dç^"$/d
GYVHp

Try it online!

Hexdump:

00000000: d32c 2ff2 0afa 6e0a 44e7 5e12 2224 2f64  .,/...n.D.^."$/d
00000010: 0a47 5956 4870                           .GYVHp

Explanation:

Ó,/ò                Replace commas with new lines
ún                  Sort; cursor ends up in first line
D                   Delete line (smallest number)
 ç^<C-r>"$/d        Delete all lines that contain the same number
GYVHp               Go to last line, copy, select all, paste
                    If all numbers are equal, the buffer is empty and nothing will be copied,
                    resulting in an empty output

APL (Dyalog Unicode), 12 bytes

Full program. Prompts for string from stdin.

{1≠≢∪⍵:⌈/⍵}⎕

Try it online!

 prompt for and evaluate expression (commas concatenate the numbers into a list)

{} apply the following anonymous lambda ( is the argument; the list of numbers):

1≠ [if] 1 is different from…

 the tally of…

 the unique numbers in…

 the list

: then

⌈/ return the max across (lit. max reduction)…

 the list

 [else: do nothing]

MATL, 15 9 bytes

U&=?}1MX>

Try it online!
Multiple testcases

Just trying to keep my MATL chops from getting too rusty!

Edit: rusty after all; saved 6 bytes, thanks to @LuisMendo.

Explanation

U     % str2num - automatically parses comma-separated strings
&=?   % Are all the values equal? 
}     % if not
1M    % Get the numeric matrix again on the stack
X>    % And find its maximum value.

Perl 5 -n -M5.010, 54 bytes

use List::Util'/.+/';@n=split/,/;uniq(@n)>1&&say max@n

Try it online!

Ruby -aplF,, 38 bytes

$_=$F.uniq.one?? p: $F.map(&:to_i).max

Try it online!

I'm generally not a fan of extensively using command line switches, but since the I/O format is very rigid - here it goes.

The input is automatically (-a) split into an array $F using comma as a separator (-F,). If it contains only one unique element, we return nil, otherwise, the max value. Finally, the output written into $_ is implicitly printed (-p). The option -l isn't really necessary - it is only there to make empty outputs discernible by line breaks.

Update: Almost forgot that we don't automatically get integers from split, just strings, which brings more boilerplate...

Java (JDK), 238 bytes

Golfed

public static String max(String s){StringTokenizer st=new StringTokenizer(s,",");TreeSet<Integer>t=newTreeSet<>();while(st.hasMoreTokens()){t.add(Integer.parseInt(st.nextToken()));}if(t.first()=t.last())return "";return Integer.toString(t.last());}

Ungolfed

import java.util.StringTokenizer;
import java.util.TreeSet;

public class max {
    public static String max(String s) {
        StringTokenizer st = new StringTokenizer(s,",");
        TreeSet<Integer> t = new TreeSet<>();
        while (st.hasMoreTokens()) {
            t.add(Integer.parseInt(st.nextToken()));
        }
        if (t.first() == t.last()) return "";
    return Integer.toString(t.last());
    }
}

I have already seen this answer, but I still wanted to share my answer.

Ruby, 39 bytes

a=eval gets
puts a.max if a.uniq.size>1

Takes an string-form array and prints the result.

F#, 112 bytes

let m(c:string)=
 let n=c.Split ','|>Seq.map int
 if Seq.distinct n|>Seq.length=1 then None else Seq.max n|>Some

Try it online!

I get the feeling that it could be made smaller, but I can't quite see how...

Rust, 128 bytes

fn f(s:&str)->Option<u32>{let v=s.split(",").map(|a|a.parse::<u32>().unwrap());let x=v.clone().max();if v.min()==x{None}else{x}}

Try it online!

Java (JDK), 101 bytes

d->{long m=0,c=-1,b;for(var s:d.split(",")){b=new Long(s);c=c<0|c==b?b:0;m=b>m?b:m;}return c>0?"":m;}

Try it online!

Explained

d->{                            // Function taking a String input
    long m=0,c=-1,b;            // Initialise variables
    for(var s:d.split(",")){    // Split by comma and loop over elements
        b=new Long(s);          // Parse String to Long
        c=c<0                   // If c<0 (i.e. this is the first element)
            |c==b               // ...or c is equal to the current element
            ?b                  // Set c to the current element (all elements are the same so far
            :0;                 // Otherwise set c to zero to denote that list is not all same element  
        m=b>m?b:m;              // Set m to max of b and m
    }
    return c>0?""               // If c is not zero then all elements are the same, return nothing
                 :m;            // Else return max element
}

Bonus solution!

Despite my best efforts I couldn't get this solution using regex and Streams to less than 105 bytes, but I really liked its elegance so had to give it an honourary mention;

d->d.matches("(.+?)(,\\1)+")?"":java.util.Arrays.stream(d.split(",")).map(Long::new).reduce(0L,Long::max)

Jelly, 4 bytes

ḟṀE?

A full program accepting the input as a command line argument (unquoted) which prints the required output

(Note that it deals with: empty input like , single item input like 7 and multiple item input like 7,8,7 like the spec seems to currently require.)

Try it online!

How?

ḟṀE? - Full program: if one argument is present it is evaluated using Python
     -                 so 7,8,7 -> [7,8,7], while 7 -> 7
ḟṀE? - Main Link: list or integer OR no argument (in which case an implicit argument of 0)
   ? - if...
  E  - ...condition: all equal? (for any integer E yields 1 since the argument is
     -                           treated as a list like [integer])
ḟ    - ...then: filter discard (since it's undefined the right argument is implicitly 
     -                          equal to the left; both are treated as lists, so this
     -                          yields an empty list)
 Ṁ   - ...else: maximum (again an integer is treated as a list)
     - implicit print (Jelly's representation of an empty list is an empty string
     -                 furthermore no newline is printed in either case)

Bash (coreutils), 28 bytes

sort -n|uniq|tail +2|tail -1

Input is a stream, one number on each line

tail +2 strips the first line, and the output is empty if it's the only line coming out from uniq, which squashes identical lines into one after sort.

Red, 81 bytes

x: split input","forall x[x/1: load x/1]sort x: unique x if 1 <>length? x[last x]

Like the R solution, a huge chunk of the code is handling the input string "1,1,2,44,1". If we can have that as a block, eg: x: [1 1 2 44 1], then we can do it in 41 bytes:

sort x: unique x if 1 <>length? x[last x]

PHP (<=5.6) 64 74 bytes

 echo array_count_values($a=split(',',$argn))[$m=max($a)]==count($a)?'':$m;

Run as pipe with -nR or test it online

split was removed in PHP7, but as I had to add 10 to fix a few issues, it was worth using instead of explode which is roughly equivalent in this case.

Actually, 9 bytes

;M@╔l1<óX

Try it online!

Actually parses comma-separated items as lists on input, so long as the items look like Python literals, so there is no overhead for the restrictive input format.

Explanation:

;M@╔l1<óX
;M         make a copy of the input, maximal element
  @╔       remove duplicates from other copy
    l1<    is 1 less than the length of the deduplicated list?
       ó   if so, immediately exit, without printing anything
        X  else, discard the length, and implicitly print the remaining stack element (the maximal element of the input list) at exit

Runic Enchantments, 39 bytes

/u'!}R:'!=?\~or:}(\
\i|'<\   }n/ ;${;?/

Try it online!

Numbers have to be separated with | to be parsed from input correctly (using , causes the list to be read as a single number as , is the group separator and C# doesn't care where it's located in the string, it ignores all of them).

No possibility of removing the three spaces in the lower line, due to the loop entrance and exit locations.

Does have a limited stack size that can be processed (9 items) due to the mana cost of the sort command (and potential bleed from large stack size and low remaining mana). A slightly larger program can handle up to 14 items.

Pyth, 7 bytes

Itl{QeS

Try it online!
All test cases (slightly different code for better output formatting)

As Pyth is based on Python, user input is always interpreted as a string, which then may be passed through eval(). All Pyth programs automatically run Q=eval(input()) as their first instruction.

Explanation:
Itl{QeS  | Full code
Itl{QeSQ | with implicit variables filled
---------+-------------------------------
I        | If
 t       | one less than
  l      | the length of
   {Q    | the deduplicated input
         | is truthy (!=0),
         | print
     e   | the last element of
      SQ | the sorted input

K4, 38 35 bytes

{$[1=#:t:?:(7h$","\:x)-48;;*:t@>t]}

Test Cases:

q)k){$[1=#:t:?:(7h$","\:x)-48;;*:t@>t]}"1,2,4,4"
,4
q)k){$[1=#:t:?:(7h$","\:x)-48;;*:t@>t]}"4,4,4,4"
q)
q)k){$[1=#:t:?:(7h$","\:x)-48;;*:t@>t]}"7,3,8,4,8,3,9,4,6,1,3,7,5"
,9
q)k){$[1=#:t:?:(7h$","\:x)-48;;*:t@>t]}"7,7,7,7,7,7,7,7,7,7,7,7,7"
q)

I'm not very fluent in any of the k variants available on TiO, so no online example available, I'll try to come up with one though

Explanation

If you're wondering why certain operations are performed before others, K4 does not have operator precedence, it instead interprets from right to left (though you can use parentheses for precedence). Expressions seperated by semicolons.

   $[expr;`True;`False] is the conditional format

{$[1=#:t:?:(7h$","\:x)-48;;*:t@>t]}
               ","\:x                 //split string on commas
            7h$                       //cast strings to long
                      -48             //they'll be from ascii format, so compensate
         ?:                           //get distinct list      
       t:                             //set list to variable t        
     #:                               //get count of t
   1=                                 //check if count t = 1
                         ;;           //return nothing if true
                             t@>t  //if false, sort t descending
                           *:         //return first value

Can probably be golfed down more, not a fan of having to use that makeshift max function at the end.

EDIT: If the commas in output are a problem, it can be fixed with two more bytes:

q)k){$[1=#:t:?:(7h$","\:x)-48;;*:,/t@>t]}"1,2,4,4"
4
                                 ,/                 //joins the single element lists into one

Taking the total to 40 37, but the comma before the number simply means that it's a single element list as opposed to an atom.

Perl 6, 26 23 22 bytes

-1 byte thanks to nwellnhof

{.max if .Set>1}o&EVAL

Try it online!

Returns an empty slip if everything is equal.

Explanation

                o&EVAL  # Eval the string to a list of integers
{              }         # Pass to code block
 .max            # Return the max
      if .Set>1  # If the list converted to a set has more than one element

XPath 3.1, 54 bytes

with the input string as the context item:

let$t:=tokenize(.,',')!xs:int(.)return max($t)[$t!=$t]

Could be reduced by one character if you allow the context to bind a shorter prefix than "xs" to the XML Schema namespace.

Explanation: takes the input string, tokenizes on "," separator, applies xs:int() to each token to convert to an integer, computes the max of the sequence, outputs the max provided the predicate $t!=$t is true. If A and B are sequences, then A!=B is true iff there is a pair of items (a from A, b from B) such that a!=b.

If the input can be supplied as a sequence of integers $s rather than a comma-separated string then the solution reduces to

max($s)[$s!=$s]

(15 bytes - which might well be the shortest solution in a language that isn't purpose-designed for brevity)

NOTE: this doesn't satisfy the requirement "represented as it is in the input" - if there's an integer with leading zeroes or a plus sign in the input, these will be lost. I suspect that's true of many other solutions as well.

Haskell, 77 75 61 bytes

f.read.('[':).(++"]")    
f a=[0|any(/=a!!0+0)a]>>show(maximum a)

Try it online!

('[':).(++"]") takes a string (e.g. "1,2,1,3") and encloses it in bracket chars ("[1,2,1,3]"). Then read turns the string into a list of integers ([1,2,1,3]).

The function f uses this tip for a shorter conditional if one of the outcomes is the empty list. any(/=a!!0+0)a checks whether the list a contains any element that is not equal to its first element a!!0. (The +0 is needed such that read knows it has to look for a list of numbers.) If all elements are equal this test results in False and the empty string is returned. Otherwise show(maximum a), that is the maximum of the list converted to a string, is returned.

Python 2, 42 41 bytes

a=input();print('',max(a))[len(set(a))>1]

Try it online!

C (gcc), 91 bytes

M(s)char*s;{long m=atol(s),o,l=0;for(;s=strchr(s,44);o<0?m-=o:0)l|=o=m-atol(++s);s=l?m:-1;}

Try it online!

Degolf

M(s)char*s;{
    long m=atol(s),o,l=0; // Read the first integer from string
    for(;s=strchr(s,44); // Advance pointer to next ','
           o<0?m-=o:0) // End of loop: if difference <0, deduct from max, increasing it to new max.
        l|=o=m-atol(++s); // Read next number, and subtract it from current max. 
                          // Bitwise-OR the difference into the l-variable
    s=l?m:-1; // End of function: if l is non-zero, there were at least two different values.
              // Return -1 if l is zero, otherwise the max value.
}

Common Lisp, 102 bytes

(lambda(x &aux(c(read-from-string(concatenate'string"#.`("x")"))))(or(apply'= c)(princ(apply'max c))))

Try it online!

The size is mainly due to inputting the data; with input as a regular list, the length reduces to 46 bytes:

(lambda(x)(or(apply'= x)(princ(apply'max x))))

Japt, 16 bytes

This would be 9 if not for the unnecessarily strict input format, 7 if throwing an error counts as outputting nothing.

Assumes the string contains at least 2 integers.

q, mn
â ÊÉ?Urw:P

Try it

Mathematica, 43 bytes

If[!Equal@@#,Max@#]&@@#~ImportString~"CSV"&

Pure function. Takes a comma-separated string as input and returns either a number or Null. I believe this is valid, as Null is not graphically displayed:

MathGolf, 5 bytes

è▀s╞╙

Try it online!

Explanation

è      Read whole input as int array
 ▀     Get unique elements
  s    Sort list
   ╞   Discard from left of array
    ╙  Get maximum of list

This works because both the max operator and the discard from left operator don't do anything for empty lists. Well, the max operator removes the list and pushes nothing for empty lists.

It could be 4 bytes if input could be taken as a list.

Python 2, 37 bytes

outputs to stderr (debug on tio).

a=input();m=max(a);m>min(a)>exit(`m`)

Try it online!

Charcoal, 15 bytes

≔I⪪S,θ¿›⌈θ⌊θI⌈θ

Try it online! Link is to verbose version of code. Explanation:

≔I⪪S,θ

Split the input on commas and cast each value to integer.

¿›⌈θ⌊θ

Test whether the maximum value is greater than the minimum value.

I⌈θ

If so then cast the maximum value to string and print.

Octave, 28 bytes

Returns the maximum (a number, which is an 1x1 matrix) or an empty (1x0) matrix.

@(a)max(a)(1+all(a(1)==a):1)

Try it online!

Ohm v2, 9 bytes

Ul1E?Oq¿↑

Try it online! Explanation:

Ul1E?Oq¿↑
U         Uniquify input
 l        Get length
  1E      Push whether length is equak to 1
    ?Oq   If so immediately quit
       ¿↑ Else print maximum

Python 2, 44 bytes

k=eval(input())
if~-len(set(k)):print max(k)

Try it online!

Neim, 4 bytes

𝐐𝐎Ξ𝐠

Explanation:

  Ξ   If
𝐐    all elements are equal
  𝐎  not
      then
   𝐠  get greatest element

Try it online!

CJam, 16 13 bytes

q',/:iL|$1>W>

Try it online!