[Question]
      [
## Intro
A friend posed this question today in a slightly different way - "Can a single [Python] command determine the largest of some integers AND that they aren't equal?".
While we didn't find a way to do this within *reasonable* definitions of "a single command", I thought it might be a fun problem to golf.
## ¬†Challenge
"*Return the largest of a list of integers if-and-only-if they are not all equal.*"
More specifically:
Given a string containing only a comma-separated list of integers:
* If they are all equal, return/output nothing
* Else, return/output the largest
## Rules
* The **input** must be a string containing only a comma-separated list of integers
* The **output** must be either nothing (no output of any kind), or else the largest element from the input, represented as it is in the input
Entries may be a full program or just a function, provided you provide some way to test them!
## Assumptions
* Assume input list elements may be more than one digit but no larger than
( 232 ‚àí 1 )
* Assume the input list has no more than a million elements
* Assume the input will not include negative values
* Assume the input will never be empty
For the avoidance of doubt, the explanation of the challenge given just after "More specifically" shall supersede the statement of the challenge above it ("Return the largest...").
## ¬†Examples
(1) All equal:
```
Input: 1,1
Output:
```
(2) Dissimilar:
```
Input: 1,2
Output: 2
```
(3) Zero!:
```
Input: 0,0,0,0,0,0,0,1,0,0
Output: 1
```
(4) Random:
```
Input: 7,3,8,4,8,3,9,4,6,1,3,7,5
Output: 9
```
(5) Larger numbers, larger list:
```
Input: 627,3894,863,5195,7789,5269,8887,3262,1448,3192
Output: 8887
```
### Additional examples:
(6) All equal, larger list:
```
Input: 7,7,7,7,7,7,7,7,7
Output:
```
(7) All equal, larger list, larger numbers:
```
Input: 61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976,61976
Output:
```
(8) Not equal, larger list, larger numbers:
```
Input: 96185,482754,96185,96185,96185,96185,96185,96185,7,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,96185,961185,96185,96185,96185
Output: 961185
```
## Scoring
This is `code-golf`, so the code with the shortest number of bytes wins!

[Answer]
# [R](https://www.r-project.org/), ~~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!](https://tio.run/##K/r/v8K2ODkxT6M41VZJR0nTOjNNIzGvUiMlMy1No0JTUzM3sQJI/zfUMdQx1jH8DwA "R ‚Äì Try It Online")
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf), 5 bytes
```
√®‚ñÄs‚ïû‚ïô
```
[Try it online!](https://tio.run/##DcuxDYAwDATAPlP8CnYSxx6HBihAFDAASwSJhpo92CSLBBevl@7163DM07aMvX9vu8691afVu3cCBQKHgghF8kSYt7gLu6o5SkQmyyhFDZnFoKo@sjAoJT@RcfgB "MathGolf ‚Äì 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.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~26 23~~ 22 bytes
*-1 byte thanks to nwellnhof*
```
{.max if .Set>1}o&EVAL
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYKvwv1ovN7FCITNNQS84tcTOsDZfzTXM0ee/NVdxYqVCmoaSoY6hkiYyT8cYiW9maGlupjMISCQ3WZoZWpjqmFgYmZua6EA4@ElzolRRSGKVUNL8DwA "Perl 6 ‚Äì 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
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
·∏ü·πÄ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!](https://tio.run/##y0rNyan8///hjvkPdza42v///99ABxkagkgA "Jelly ‚Äì 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)
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 12 bytes
Full program. Prompts for string from stdin.
```
{1‚â†‚â¢‚à™‚çµ:‚åà/‚çµ}‚éï
```
[Try it online!](https://tio.run/##zY49CgJBDIX7OYUHeINmfjPeZkGwWXBbEWt3Qe3sxdLeC81F1qw2ziIi2JgwL0zeR5KqqfViXdWrZZ/bXdNvKHfn3F1ye82H2zzv26nUbT6eBr/XWqvJIxpFIKXKhikbM7wmDVoCERYMJ88iSQ0CWUT4EgtGQE7CBQtPySNGTvAmJDCzmCYYkHMyh5IZ7xjlaDalGPAHWp6VArGHYxO9w/PzWeNX1I/61rgD "APL (Dyalog Unicode) ‚Äì 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]
[Answer]
# [APL (Dyalog Classic)](https://www.dyalog.com/), 6 bytes
```
‚ç™‚åà/~‚åä/
```
[Try it online!](https://tio.run/##zY5NCsJADIX3PUUP8ErN/CbHGSoVoaDQlRuXIlLBc3isucg4Tl2IiAhuJOQ9ki8JCduhWe7CsFk13RDGcd2l1MfDpY7na5yO7T5OpzalpuprAlWzq@ILPAfdtfQ9NBgmp4Zkd5lpeNhCncqcJWOnYUksvGeBVU7AzBkqp0DG5HUS9bj4EvMlEu/wB1q@EUdsYVh5azAXn9V/NfWjvgU3 "APL (Dyalog Classic) ‚Äì Try It Online")
a [train](https://codegolf.stackexchange.com/questions/17665/tips-for-golfing-in-apl/43084#43084) 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
[Answer]
# [CJam](https://sourceforge.net/p/cjam), ~~16~~ 13 bytes
```
q',/:iL|$1>W>
```
[Try it online!](https://tio.run/##S85KzP3/v1BdR98q06dGxdAu3O7/f2MdKAQA "CJam ‚Äì Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 37 bytes
outputs to stderr (debug on tio).
```
a=input();m=max(a);m>min(a)>exit(`m`)
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9E2M6@gtERD0zrXNjexQiMRyLDLzcwDMuxSKzJLNBJyEzT//7c0M7Qw1TGxMDI3NdGBcPCT5kSpopDEKgEA "Python 2 ‚Äì Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~42~~ 41 bytes
```
a=input();print('',max(a))[len(set(a))>1]
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P9E2M6@gtERD07qgKDOvRENdXSc3sUIjUVMzOic1T6M4tQTEtjOM/f//PwA "Python 2 ‚Äì Try It Online")
[Answer]
# [Haskell](https://www.haskell.org/), ~~77~~ ~~75~~ 61 bytes
```
f.read.('[':).(++"]")
f a=[0|any(/=a!!0+0)a]>>show(maximum a)
```
[Try it online!](https://tio.run/##DclBCoJAFADQfacYJXAGf6ajjn8C3XQBl4G5@Jim5BioUUFnb@ptX0/LrR1Ha2iYWM6GaW1nala2ZWfbBXNLl4B7lXcQAfd9t3bFpmOUV@GHpjff5@Q4oR8Kqoti6e9Pbug1mIdhJKxVMoMYdQKoYkgjnUKWoYZUKg2I@E@pJERJghBHWn6bbqTrYnenY1n@AA "Haskell ‚Äì 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](https://codegolf.stackexchange.com/a/150792/56433) 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.
[Answer]
# 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]
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 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!](https://tio.run/##dclBCoMwEADAez@SDcRFr8LqC3xBEVx0Yy2pETdIfX0s3ssc580H67gvWyrWOEnOnpQaYFLULSxpcINFOWQ/QajhZ9kTiW2NqTtOL/zwFxCR7WOMq8YgGOIMHkzlbsb@m/JXOV8 "JavaScript (Node.js) ‚Äì Try It Online")
---
## Improved version using `Set()` by [Shaggy](https://codegolf.stackexchange.com/users/58974/shaggy), 49 bytes
```
s=>new Set(a=s.split`,`).size>1?Math.max(...a):``
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@7/Y1i4vtVwhOLVEI9G2WK@4ICezJEEnQVOvOLMq1c7Q3jexJEMvN7FCQ09PL1HTKiHh/38A "JavaScript (Node.js) ‚Äì Try It Online")
[Answer]
# [Neim](https://github.com/okx-code/Neim), 4 bytes
```
ùêêùêéŒûùê†
```
Explanation:
```
  Œû   If
ùêê    all elements are equal
  ùêé  not
      then
   ùê†  get greatest element
```
[Try it online!](https://tio.run/##y0vNzP3//8PcCROAuO/cPCC54P//aDMjcwVjC0sTBQszYwVTQ0tTBXNzC0sFUyMzSwULCwugpJGZkYKhiYmFgrGhpVEsAA "Neim ‚Äì Try It Online")
[Answer]
# [Octave](https://www.gnu.org/software/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!](https://tio.run/##y08uSSxL/Z9mq6en999BI1EzN7ECSGoYaifm5Ggkahhq2tomaloZav635krTiDbQAcJYTRjTMFbzPwA "Octave ‚Äì Try It Online")
[Answer]
# 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](https://ethproductions.github.io/japt/?v=1.4.6&code=cSwgbW4K4iDKyT9Vcnc6UA==&input=IjgsOCI=)
[Answer]
# Common Lisp, 102 bytes
```
(lambda(x &aux(c(read-from-string(concatenate'string"#.`("x")"))))(or(apply'= c)(princ(apply'max c))))
```
[Try it online!](https://tio.run/##LcrbCoMwEIThV5Et1AlEoe1136XrakXIiagQnz4u6A9z8zHiljVVVDj2w8gozZP3AkGeeOz@Ofpu3fISZkgMwtsUdO1F9Oh/oEKGjIaYwSm5o/02YpD0ITd4LkpapZd92w@ZegI)
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))))
```
[Answer]
# [K4](http://kx.com/download), 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.
[Answer]
## 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](http://sandbox.onlinephpfunctions.com/code/8dd641d7b372b891909904c4dba616ba0b9a8498)
`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.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) `-hF`, 8 bytes
```
q, √ºn √Öc
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.6&code=cSwg/G4gxWM=&input=IjEsMiIKCi1oRgo=)
`-3` bytes if the input could be taken as an array.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~9~~ 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
',¬°Zs√ãi√µ
```
-1 byte thanks to *@Cowabunghole*.
[Try it online](https://tio.run/##yy9OTMpM/f9fXefQwqjiw92Zh7f@/29maGlupkNHEgA) or [verify all test cases](https://tio.run/##zYwxCgJBDEX7OcViY/MLk5nJJNXew07BYiuLBWFBWxs7b@AhvIB7Ey8yRmxERAQbCXkheUnW/WLZrep2M7ST5ro/NpN2qFNcTvN@PHTjue5QCRQIHGZ4DrozFEQokmeEeRWfRxTkIOxOzZVEZLKMUtSQWQyq6pKFQSn5KRn7p5cIQlYEf8BgQpqRlEtOeDSfWb7a@pFvxQ0).
**Explanation:**
```
',¬°        '# Split the (implicit) input by ","
   Z        # Push the maximum (without popping the list)
    s       # Swap so the list is at the top of the stack again
     √ãi     # If all elements are equal:
       √µ    #  Push an empty string ""
            # (Implicitly output the top of the stack to STDOUT as result)
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~45~~ 49 bytes
*+4 bytes thanks Veskah*
```
($l=$args-split','|sort{+$_}-u)[-1]|?{$l.count-1}
```
[Try it online!](https://tio.run/##TY5BCsIwFET3OcUnfDXBRJouhaIH8AYiRWrUQmxrkqKQ9uyxVKvObubNwDT1Q1t31cZEPEMGITI0GR7txUnXmNIvxKJztfVhiXkvW76X6tBtAppVUbeVl6qPPSFbRmCQYFQJRYH/XEoFpH9eJWOkEk44dDCDMDKs2tuudF4A6mejC69PwxvM39Bq1xo/BPPh5FQdEUX2oVLfv1O@njaU9PEF "PowerShell ‚Äì Try It Online")
Less golfed:
```
$list=$args-split','|sort{+$_}-unuqie
$max=$list[-1]
$max|?{$list.count-1}
```
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 5 bytes
```
‚âà[¬§|G
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLiiYhbwqR8RyIsIiIsIjYyNywzODk0LDg2Myw1MTk1LDc3ODksNTI2OSw4ODg3LDMyNjIsMTQ0OCwzMTkyIl0=)
```
‚âà[    # If all same
  ¬§   # ""
   |G # Else max
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
```
·πÄ·∏ü·πÇ
```
[Try it online!](https://tio.run/##zZE9CgIxEIWvYiu8wpkk83MUkS1tZC9gJzYew2u4tSfJSeJktxEREWxkmPeYfJNHIIf9OB5bq9Op3q51Orf7Zb1tbUegAasw7rbBc1HXfqxIMOToBA@XQAmK0qFwYPOgklDIC1TNUVgcZhaQhUE5x21yXvJeas4hV8EfaH@MC1lBNtaSsQyfVb/a@lHfgvn7hgc "Jelly ‚Äì 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](https://tio.run/##y0rNyan8///hzoaHO@Y/3Nn0//9/cx1jHQsdEyA21rEE0mY6hkCWuY4pAA). 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.
```
[Answer]
# [Python 2](https://docs.python.org/2/), 44 bytes
```
k=eval(input())
if~-len(set(k)):print max(k)
```
[Try it online!](https://tio.run/##zY7PTsMwDMbPy1PkllYz0pI2/zb1WK5ceICVErSoXVtlGXQXXr243QUhhEBcJis/x/n8OR4u8dB3Yqr7Z0cLyhibmsK9Vm3iu@EckzQl/uX9rnVdcnIxadJ0OwTfRXqsRqwmNBDiiw15O/jW0cdwdluyiuGCXPl1wXf02s/KsToO2MLWe79H0Y2uTuZvU4L32g2Rlg/3ZQh9mL1PwVUNIcv8v2y0WCbGgTOCFMgNfA4@E181ZGAgx5OBxaxQyUCDRE0JVI1FUWUguZWgtbEghbJgjEFRKAE8z9HMrVimfYl5CrdawQ0Qd7GKGwm5EVrmcC1@pv5V1z/5rcCmDw "Python 2 ‚Äì Try It Online")
[Answer]
# [Ohm v2](https://github.com/nickbclifford/Ohm), 9 bytes
```
Ul1E?Oq¬ø‚Üë
```
[Try it online!](https://tio.run/##y8/INfr/PzTH0NXev/DQ/kdtE///jzbSAcLY/wA "Ohm v2 ‚Äì 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
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 15 bytes
```
‚âîÔº©‚™™Ôº≥,Œ∏¬ø‚Ä∫‚åàŒ∏‚åäŒ∏Ôº©‚åàŒ∏
```
[Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU/DObG4RCO4ICezRMMzr6C0JLikKDMvXUNTR0FJR0kTSBVqWnNlpilouBelJpakFmn4JlZk5pbmahQC5Xwz86BsTU2FAKDGEoh5CDWamtb//5vroMH/umU5AA "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Explanation:
```
‚âîÔº©‚™™Ôº≥,Œ∏
```
Split the input on commas and cast each value to integer.
```
¬ø‚Ä∫‚åàŒ∏‚åäŒ∏
```
Test whether the maximum value is greater than the minimum value.
```
Ôº©‚åàŒ∏
```
If so then cast the maximum value to string and print.
[Answer]
# 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:
![](https://i.stack.imgur.com/idnDr.png)
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 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!](https://tio.run/##pY9tS8MwEMdfu08RMoTEXaHpU5LWMPZigugQNn3nm1LbbdCH0RQU5r66XTa7YUVEkCN3ubvf/7hLrGWStO2MaJqs4vpKR9u8KpeoUHFT5aYKFeTKjrKqJpFWuqmTVU00eB6Nqmt7XFiqCm2av6tKFdZRMxppatB8XIQWi3bt8CXN1mWKJovFdP5I0rcNRZt6XTYZwROt07pBlzpEeGg6@LnEgMxnjB/ucIhvJrf3T/MppoMiXpeEbgcX3RiLIaXQjGAGDFManRvOue706ifehq/GDr7HyY7j4IIAzzwXpImBYV3g4PdoIQTvBIFjJEIaReCCz6QPnAsJvhNIOGDgOoEDzPPMRCb7y52v4fDNjthptYAx4XekSYQPnnC478Fn8rvnf6L@6X9sHG/YtR9JlsdL3Vqvew "C (gcc) ‚Äì 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.
}
```
[Answer]
# 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.
[Answer]
# Pyth, 7 bytes
```
Itl{QeS
```
[Try it online!](https://pyth.herokuapp.com/?code=Itl%7BQeS&input=1%2C3&debug=0)
[All test cases (slightly different code for better output formatting)](https://pyth.herokuapp.com/?code=Itl%7BQpeS&test_suite=1&test_suite_input=1%2C1%0A1%2C2%0A0%2C0%2C0%2C0%2C0%2C0%2C0%2C1%2C0%2C0%0A7%2C3%2C8%2C4%2C8%2C3%2C9%2C4%2C6%2C1%2C3%2C7%2C5%0A627%2C3894%2C863%2C5195%2C7789%2C5269%2C8887%2C3262%2C1448%2C3192%0A7%2C7%2C7%2C7%2C7%2C7%2C7%2C7%2C7%0A61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%2C61976%0A96185%2C482754%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C7%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C96185%2C961185%2C96185%2C96185%2C96185&debug=0)
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
```
]


[Question]
      [
*Inspired by [this Stack Overflow question](https://stackoverflow.com/q/52657041/2586922)*.
## The challenge
### Input
An array of square matrices containing non-negative integers.
### Output
A square matrix built from the input matrices as follows.
Let \$N \times N\$ be the size of each input matrix, and \$P\$ the number of input matrices.
For clarity, consider the following example input matrices (\$N=2\$, \$P=3\$):
```
 3   5
 4  10
 6   8
12  11
 2   0
 9   1
```
1. Start with the first input matrix.
2. Shift the second input matrix *N*−1 steps down and *N*−1 steps right, so that its upper-left entry coincides with the lower-right entry of the previous one.
3. Imagine the second, shifted matrix as if it were stacked on top of the first. Sum the two values at the coincident entry. Write the other values, and fill the remaining entries with `0` to get a \$(2N-1)\times(2N-1)\$ matrix. With the example input, the result so far is
```
 3   5   0
 4  16   8
 0  12  11
```
4. For each remaining input matrix, stagger it so that its upper-left coincides with the lower-right of the accumulated result matrix so far. In the example, including the third input matrix gives
```
 3   5   0   0
 4  16   8   0
 0  12  13   0
 0   0   9   1
```
5. The ouput is the \$((N−1)P+1)\times((N−1)P+1)\$ matrix obtained after including the last input matrix.
## Additional rules and clarifications
* \$N\$ and \$P\$ are positive integers.
* You can optionally take \$N\$ and \$P\$ as additional inputs.
* Input and output can be taken by [any reasonable means](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods). Their format is flexible as usual.
* Programs or functions are allowed, in any [programming language](https://codegolf.meta.stackexchange.com/questions/2028/what-are-programming-languages/2073#2073). [Standard loopholes are forbidden](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default).
* Shortest code in bytes wins.
## Test cases:
In each case, input matrices are shown first, then the output.
1. \$N=2\$, \$P=3\$:
```
 3   5
 4  10
 6   8
12  11
 2   0
 9   1
 3   5   0   0
 4  16   8   0
 0  12  13   0
 0   0   9   1
```
2. \$N=2\$, \$P=1\$:
```
 3   5
 4  10
 3   5
 4  10
```
3. \$N=1\$, \$P=4\$:
```
 4
 7
23
 5
39
```
4. \$N=3\$, \$P=2\$:
```
11  11   8
 6   8  12
11   0   4
 4   1  13
 9  19  11
13   4   2
11  11   8   0   0
 6   8  12   0   0
11   0   8   1  13
 0   0   9  19  11
 0   0  13   4   2
```
5. \$N=2\$, \$P=4\$:
```
14  13
10   0
13  20
21   3
 9  22
 0   8
17   3
19  16
14  13   0   0   0
10  13  20   0   0
 0  21  12  22   0
 0   0   0  25   3
 0   0   0  19  16
```

[Answer]
# [R](https://www.r-project.org/), ~~88~~ 81 bytes
```
function(A,N,P,o=0*diag(P*(N-1)+1)){for(i in 1:P)o[x,x]=o[x<-1:N+i-1,x]+A[[i]];o}
```
[Try it online!](https://tio.run/##XYnBCoJAFEV/xeV7egd8Y0WZLvwBcS8uxJh4YA6YgRB9@2QQLdrcwzl3Di4qTHCPaVjUT1ShRgNfpvFF@ys1MdVGOBHmp/MzaaRTJHnDvl2xduWGwkheJ2pk86RqW@26s38FR6PeF7r1y6wrDZRhhz0kZVhYxq8fIBZHiPwfFiek@ObPZhze "R – Try It Online")
Takes a `list` of matrices, `A`, `N`, and `P`.
Builds the requisite matrix of zeros `o` and adds elementwise the contents of `A` to the appropriate submatrices in `o`.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~15~~ 12 bytes
```
⁹ṖŻ€ƒZƲ⁺+µ@/
```
[Try it online!](https://tio.run/##bU49DsIgGN09BaNGEoH@2c3NO0gYXZpewLEu7g6ewsnEJtXEocbeQy6C3wOqiwmEx/vez1dt63rnnG26d3d63e3@PBw3w8U2t3l/XS3c80DUmm5lm0ff9q1z0wnTWiecZYYznXImhQHSOWdLAKmIk4EjKABKogxR/7yRTYOjiMYkvNl3LiViYwe66Kt8H5GCs@hHKJ1kbC39MpBRLQ3VLzAddVJgTW@HSvmVFcXEJShD@SqB@qArMIUXBbkPnX0A "Jelly – Try It Online")
### How it works
```
⁹ṖŻ€ƒZƲ⁺+µ@/  Main link. Argument: A (array of matrices)
         µ    Begin a monadic chain.
          @/  Reduce A by the previous chain, with swapped arguments.
                Dyadic chain. Arguments: M, N (matrices)
      Ʋ           Combine the links to the left into a monadic chain with arg. M.
⁹                 Set the return value to N.
 Ṗ                Pop; remove its last row.
     Z            Zip; yield M transposed.
    ƒ             Fold popped N, using the link to the left as folding function and
                  transposed M as initial value.
  Ż€                Prepend a zero to each row of the left argument.
                    The right argument is ignored.
       ⁺        Duplicate the chain created by Ʋ.
        +       Add M to the result.
```
[Answer]
# JavaScript (ES6), 102 bytes
Takes input as `(n,p,a)`.
```
(n,p,a)=>[...Array(--n*p+1)].map((_,y,r)=>r.map((_,x)=>a.map((a,i)=>s+=(a[y-i*n]||0)[x-i*n]|0,s=0)|s))
```
[Try it online!](https://tio.run/##bY/NasMwEITvfRIpGQut5Pz44EKfQ4gi0qS4pLaRQ4nB7@6uJHpJc1oNO5r59iv8hOkUu/FW9cPHeb20q@gxIsj21Sml3mIMs6iqfjNuSXr1HUYh3jEjsiH@yTuLUERAx2LatiK4ueo2vV8WLd29PDWmVstlknI9Df00XM/qOnyKizCwcM5Z7DxcDdKep9vjyIMMiLI20DwasPJSvjxG0GPEfxOhTqY6xx1KqM1j98xuYZKdiAkyCxOBTIIiaJQY7gLZAtYkVN5a7jHPKTMA1eULaZRT@YdJxxlC4WlgUo/m2rw/IPu5YJ9z118 "JavaScript (Node.js) – Try It Online")
### How?
Redimensioning matrices filled with a default constant (\$0\$ in that case) is neither very easy nor very short in JS, so we just build a square matrix with the correct width \$w\$ right away:
$$w=(n-1)\times p+1$$
For each cell at \$(x,y)\$, we compute:
$$s\_{x,y}=\sum\_{i=0}^{p-1}{a\_i(x-i\times (n-1),y-i\times (n-1))}$$
where undefined cells are replaced with zeros.
[Answer]
# [Python 2](https://docs.python.org/2/), 124 bytes
```
def f(m,N,P):w=~-N*P+1;a=[w*[0]for _ in' '*w];g=0;exec"x=g/N/N*~-N;a[x+g/N%N][x+g%N]+=m[x][g/N%N][g%N];g+=1;"*P*N*N;return a
```
[Try it online!](https://tio.run/##ZZBBboMwEEX3OcUoEgLMtMGGJE0srmCxt6wKNUCpFBNRKuimV6djQ1ddfc/4P/8ZP77H996KZbnVDTTRHRWW8XUqfp4UKxMuq0JPTKem6Qd4hc6GELLJyLZIZT3Xb/u5aA/qoBj5ZaXnhKpAGXcgSYq7no3eeq4j26Tgcs9KppiSQz1@DRaqxb0@1p8jBUCktc7waFDnyFNDqk/4QsIFcu5rgSnJBakyKDCL8R9lEAQC325yj51XOPNy9B6OkG8eTmDmYlJcU3mGwuUIjityQSFIU5rG35/R@2mO019gHl93AG6doZ/cNk3E3GK@DfAYOjsC/eHzR9/ZKAzELYQArCes8xMW7zbj8gs "Python 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 12 bytes
```
Z€Ż€’}¡"Jµ⁺S
```
[Try it online!](https://tio.run/##y0rNyan8/z/qUdOao7uBxKOGmbWHFip5Hdr6qHFX8P/D7e7//0dHRxvrKJjG6ihEm@goKBgaxAKZXArR0WY6ChYgUUMjHQVDQ6AoSBDINgAJWoKUxsZyxQIA "Jelly – Try It Online")
```
Z€Ż€’}¡"Jµ⁺S
         µ    Everything before this as a monad.
          ⁺   Do it twice
Z€            Zip €ach of the matrices
        J     1..P
       "      Pair the matrices with their corresponding integer in [1..P] then apply the
              following dyad:
  Ż€            Prepend 0 to each of the rows
      ¡         Repeat this:
    ’}          (right argument - 1) number of times
              Doing everything before µ twice adds the appropriate number of rows and
              columns to each matrix. Finally:
           S  Sum the matrices.
```
**[12 bytes](https://tio.run/##y0rNyan8/9/rUcNMg4e7uq0fbVynFPWoac2hrY8adwX/P9zu/v9/NJdCdLSxjoJprI5CtImOgoKhQSyQCRI101GwAIkaGukoGBoCRUGCQLYBSNASpDQ2lisWAA)**
```
J’0ẋ;Ɱ"Z€µ⁺S
```
If extra zeroes were allowed `ZŻ€‘ɼ¡)⁺S` is a cool 9 byte solution. [TIO](https://tio.run/##y0rNyan8/z/q6O5HTWseNcw4uefQQs1HjbuC/x9ud///Pzo62lhHwTRWRyHaREdBwdAgFsjkUoiONtNRsACJGhrpKBgaAkVBgkC2AUjQEqQ0NpYrFgA).
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 20 bytes
```
µ;€0Zð⁺0ṁ+ṚU$}ṚU+⁸µ/
```
[Try it online!](https://tio.run/##y0rNyan8///QVutHTWsMog5veNS4y@DhzkbthztnharUgkjtR407Dm3V/3908sOdix817ju07dC2h7u3PNyx6dDOY@1hx7qAOlWA@HD7//@GJgoKhsZchgYKCgoGXFyGxgoKRgZcRoZArjEXl4IlkGvEpQCStQDKmoOFDYGihmYA "Jelly – Try It Online")
Bah, Jelly has an attitude today...
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 37 bytes
```
{i:0{Y#i-1aM:0RLyAL_i+:yZG#@aALa}Mai}
```
A function that takes a list of lists of lists. [Try it online!](https://tio.run/##bY6xCsMgFEV3v@JCxhLwqWkbp2TqEqF0ax9SHN2yhpBvt0pMpm6Xw7v3vDnOKa3RyvXdxJaCs/I1LeP0jRe7fB7NEMYpbC7ELTnBAsys0XkBgA1I@hKZr7jvjBSIKlSQO@yRkRf/2pWaWrkdVV1Dd54Q5eVDk30gVZUEiWMgr4L0qe3LN/uVhoEqaz6l9vkD "Pip – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 124 bytes
```
def f(A,N,P):M=N-1;R=G(M*P+1);return[[sum(A[k][i-k*M][j-k*M]for k in G(P)if j<N+k*M>i>=k*M<=j)for j in R]for i in R]
G=range
```
[Try it online!](https://tio.run/##JY2xCoMwFEX3fkXGRCP0pV1ajeDkpIjrI0OhxibSKKkO/fo0WrhwLpcDd/mur9mJEJ6DJppWvOUduzeyzSDvZU2bpEuB5X5YN@8QP9ubVjgpNNmUNArtAT17MhHjSE07ZjSxRZvGvTSljCikZbthd6M/ZPOvp1r6hxuHsHjj1nhPEBG4UBwv/Koi8MbhHAnAQai4EBHDQvgB "Python 2 – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 52 bytes
```
≦⊖θＥ⊕×θηＥ⊕×θηΣＥＥη×θξ∧¬∨∨‹ιν›ι⁺θν∨‹λν›λ⁺θν§§§ζξ⁻ιν⁻λν
```
[Try it online!](https://tio.run/##hY1Na8MwDIbv/RWiJwc0iJOyD3oqDEbLuhW2m8khJGYxOErrOKPsz3tySALdZcZGyM/zSlVTuqorbQjH8rzre/NF4llXTreavK4RLsl2dXKGvGBB7GlB4tO0uhcXhCZJEA6doX@Uj6EdjfgahAVeI9xRLd46L95dvK@674VBICYvTpdeu9ie7DAmKImR2bO3nr31xuF@T7W@ir/1Jy5HOBoapnVLZ@c0/6xhzXUbgspwBRt@Sim5QZB5wQ2AkilCWowNkxwhSyeSSYR8Jk8Msglw4nFJPERpGsWSvC/4hLtv@ws "Charcoal – Try It Online") Link is to verbose version of code and includes two bytes for somewhat usable formatting. I started off with a version that padded all the arrays and then summed them but I was able to golf this version to be shorter instead. Explanation:
```
≦⊖θ
```
Decrement the input value \$N\$.
```
Ｅ⊕×θηＥ⊕×θη
```
Compute the size of the result \$(N-1)P+1\$ and map over the implicit range twice thus producing a result matrix which is implcitly printed.
```
ΣＥＥη×θξ
```
Map over the implicit range over the input value \$P\$ and multiply each element by \$N-1\$. Then, map over the resulting range and sum the final result.
```
∧¬∨∨‹ιν›ι⁺θν∨‹λν›λ⁺θν
```
Check that neither of the indices are out of range.
```
§§§ζξ⁻ιν⁻λν
```
Offset into the original input to fetch the desired value.
]


[Question]
      [
# Supreme Sum String
Given an input string, return the word with the highest sum of each of its unicode characters.
## Rules
* The input should be seperated by whitespace
* The value of each word is based on the sum of each character in the word's UTF-16 code
* The output should be the first word with the highest value (in case of duplicate sums)
## Examples
```
Input: "a b c d e"
Output: "e"
Input: "hello world"
Output: "world"
Input: "this is a test"
Output: "test"
Input: "√†√† as a test"
Output: "√†√†"
Input "Œ± √§√§"
Output: "Œ±"
Input: "üç¨ Ôß±Ôß±Ôß±"
Output: "Ôß±Ôß±Ôß±"
Input: "üíÄ üëª ü§° ü¶á üï∑Ô∏è üç¨ üéÉ"
Output: "üï∑Ô∏è"
```
This is code golf, so the shortest answer wins! Good luck :)

[Answer]
# [Perl 6](http://perl6.org/), 34 bytes
```
*.words.max(*.encode('utf16').sum)
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtfS688vyilWC83sUJDSy81Lzk/JVVDvbQkzdBMXVOvuDRX87@1QnFipYKSSryCrZ1CdZqCSnytkkJafpGCUqJCkkKyQopCqpKOglJGak5OvgLQtJwUELckI7NYAYgSFUpSi0tAIocXHF6gkIgs8mH@pAaFD/Mn7gYSSxYCiWXtQGLq9vc7@oF07xog0des9B8A "Perl 6 ‚Äì Try It Online")
[Answer]
# [R](https://www.r-project.org/), ~~77 69 59 58 56~~ 44 bytes
A group effort now.
```
'^'=mapply
sort(-sum^utf8ToInt^scan(,""))[1]
```
[Try it online!](https://tio.run/##K/r/Xz1O3TY3saAgp5KrOL@oREO3uDQ3rrQkzSIk3zOvJK44OTFPQ0dJSVMz2jD2/@EFhxdwJRZzJXKVpBaX/AcA "R ‚Äì Try It Online")
Convert to code points, sum each word, negate, (stably) sort, return first element.
Technically the return value is a "named vector" whose value is the sum and name is the winning word, but this seems to follow the rules. If you want to return the winning word as a string, you'd have to spend 7 more bytes and wrap the above in `names()`.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 8 bytes
```
√∞¬°RŒ£√áO}Œ∏
```
[Try it online!](https://tio.run/##yy9OTMpM/V9TVvn/8IZDC4POLT7c7l97bsd/nf@JCkkKyQopCqlcGak5OfkK5flFOSlcJRmZxQpAlKhQklpcwnV4weEFColw7of5kxoUPsyfuBtILFkIJJa1A4mp29/v6AfSvWuARF8zAA "05AB1E ‚Äì Try It Online")
**Explanation**
```
√∞¬°          # split input on spaces
  R         # reverse the resulting list
   Œ£  }     # sort by
    √áO      # sum of character codes
       Œ∏    # take the last
```
[Answer]
# JavaScript (ES6), 81 bytes
```
s=>s.split` `.map(m=s=>m=[...s].map(c=>t+=c.charCodeAt(),t=0)&&t<=m?m:(r=s,t))&&r
```
[Try it online!](https://tio.run/##ZYzBSgMxEIbvPsWQQ0mwpp6lqYiPUYTGbNpdSZolGepV8OBJRcFzK4gn7woe@0D2DbaTLahsh@Ef@P//myu90MnEqsajeShsM1VNUqMkU@0qnMBEel1zr8jzaiylTBetY9QID5WRptTxnLgz5KKP6lj0ejhU/tSf8KhSHwUZsTFhnoKz0oUZn3Km4RIMFGCZEPA3gwEwyw465dI6F@A6RFf8r@fyzuwCWFYJaDWgTfjLZKA1uv31ar0CvdffETncIzbL5xvYLJ@@Sd5eSd7vSF4@f74e6d5/kDzcto/yi5wwipot "JavaScript (Node.js) ‚Äì Try It Online")
[Answer]
# jq, ~~61~~ ~~43~~ ~~57~~ 37 characters
(~~57~~ ~~39~~ ~~53~~ 33 characters code + 4 characters command line options)
```
./" "|reverse|max_by(explode|add)
```
Sample run:
```
bash-4.4$ jq -Rr './" "|reverse|max_by(explode|add)' <<< '√†√† as a test'
√†√†
```
[Try it online!](https://tio.run/##yyr8/19PX0lBqaYotSy1qDi1JjexIj6pUiO1oiAnPyW1JjElRfP//8MLDi9QSCxWSFQoSS0u@a8bVAQA "jq ‚Äì Try It Online")
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~74~~ 52 bytes
```
(-split$args|sort{$r=0;$_|% t*y|%{$r+=$_};$r}-u)[-1]
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X0O3uCAns0QlsSi9uKY4v6ikWqXI1sBaJb5GVaFEq7JGFcjXtlWJr7VWKarVLdWM1jWM/f//v9LhBYcXKCQWKyQqlKQWlygBAA "PowerShell ‚Äì Try It Online")
*Thanks to mazzy for a whopping -22 bytes.*
`-split`s the input `$args` on whitespace, pipes that into `sort` with a particular sorting mechanism `{...}` and the `-u`nique flag.
Here we're taking the current word `$_`, changing it `t`oCharArra`y`, then for each letter we're adding it into our `$r`esult. That turns the string into a number based on its UTF-16 representation.
For once, PowerShell having all strings be UTF-16 in the background is a life-saver!
We then encapsulate those results in `(...)` to transform them into an array and take the last `[-1]` one, i.e., the largest result that's the closest to the start of the sentence. This works because of the `-u`nique flag, i.e., if there's a later element that has the same value, it's discarded. That word is left on the pipeline and output is implicit.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~8~~ 7 bytes
```
eosCMNc
```
[Test suite](https://pythtemp.herokuapp.com/?code=eosCMNc&test_suite=1&test_suite_input=%22a+b+c+d+e%22%0A%22hello+world%22%0A%22this+is+a+test%22%0A%22%C3%A0%C3%A0+as+a+test%22%0A%22%CE%B1+%C3%A4%C3%A4%22%0A%22%EF%BF%BD%EF%BF%BD+%EF%A7%B1%EF%A7%B1%EF%A7%B1%22%0A%22%EF%BF%BD%EF%BF%BD+%EF%BF%BD%EF%BF%BD+%EF%BF%BD%EF%BF%BD+%EF%BF%BD%EF%BF%BD+%EF%BF%BD%EF%BF%BD%EF%B8%8F+%EF%BF%BD%EF%BF%BD+%EF%BF%BD%EF%BF%BD%22&debug=0)
I know there's already a Pyth answer but I feel like this uses a pretty different approach ~~and also it's waaaay shorter~~
Explanation:
```
eosCMNc  | Full code
eosCMNcQ | with implicit variables added
---------+------------------------------------
e        | The last element of
      cQ | the input chopped at whitespace
 o       | sorted by
  s      | the sum of
   CMN   | the Unicode value of each character
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
·∏≤OS$√ê·πÄ·∏¢
```
[Try it online!](https://tio.run/##ASgA1/9qZWxsef//4biyT1Mkw5DhuYDhuKL///8iw6DDoCBhcyBhIHRlc3Qi "Jelly ‚Äì Try It Online")
```
·∏≤OS$√ê·πÄ·∏¢
·∏≤        Split input on spaces
    √ê·πÄ   Give words that have maximum of:
   $       Monad:
 O           ord(each character)
  S          sum
      ·∏¢  First word that gives the max ord-sum.
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~55~~ 52 bytes
```
lambda s:max(s.split(),key=lambda w:sum(map(ord,w)))
```
[Try it online!](https://tio.run/##PckxDoMwDADAva/wFltCXboh8ZMurhIIIsYRTkX5DX/hYSlIVcfT5a1EnR@17541sbw8g7XCH7S75TQWdOComcLW/XZt7S0onFEX36xEVPMyzgV7dDGkpOB1gBhkUkd0@9@xHzuwAUMJVuDi@fUL "Python 3 ‚Äì Try It Online")
* -3 bytes thanks to Gigaflop for pointing out that no argument is needed in the `split` method.
[Answer]
# MATLAB, 57 bytes
```
s=strsplit(input('','s'));[Y I]=max(cellfun(@sum,s));s(I)
```
In my MATLAB R2016a all tests arepassed, except that emojis are not rendered properly. But characters are returned correctly
[Answer]
# [Java (JDK)](http://jdk.java.net/), ~~117~~ ~~97~~ 84 bytes
-13 bytes thanks @Nevay. Apparently I didn't know I can also use `var` in Java.
```
s->{var b="";for(var a:s.split(" "))b=a.chars().sum()>b.chars().sum()?a:b;return b;}
```
[Try it online!](https://tio.run/##bZCxTsMwEIb3PsXJUzI03Ru1bGxMjIjhkjiti5tUtlNUVZWQGJgAgcTC0iIqJpZOIDFm73sw0TcIdpKmDdSyTvZ/3//r7AGOsTkILjKfo5RwgiyCaQNYpKgI0adwMjlOIl@xONfhVAkW9SDUmlWepe02YNYAqVAxf98QupVqvCF0MtnsTscowOsQ4oaxsMwF29KRI86URYDYttdBx@@jkJbtyGRo2V2vfj/CtucKqhIRgefOMoDaBOOYBcDj3m7AYvSJVHToxIlyRlpXPLJCJ3@ItMsnjBKP64D9nKH@kTLo7BxQ9Mo0k08QPPAhAEpsF@qr1QJCyRbsU85juIwFD/6iBiwaW1j1mQS9ERSVqsYbOBe3bLpIF4AH2YI2QEWvV5Au0@X/aSt8vargzfz2Hb6fX4t9wGP4XX9ne7yCzfzhS5fliy5vN7o8ffx83kMeuZnfXedpxm86RLfM98@yXw "Java (JDK) ‚Äì Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt) `-h`, 8 bytes
[@Emigna approach](https://codegolf.stackexchange.com/a/173427/78039)
```
¬∏w √±_¬¨xc
```
[Try it online!](https://tio.run/##y0osKPn//9COcoXDG@MPralI/v9f6cP8SQ0KH@ZP3A0kliwEEsvagcTU7e939APp3jVAoq9ZSUE3AwA "Japt ‚Äì Try It Online")
---
Another Approach
# [Japt](https://github.com/ETHproductions/japt) `-g`, 8 bytes
```
¬∏√±@-X¬¨xc
```
[Try it online!](https://tio.run/##y0osKPn//9COwxsddCMOralI/v9f6cP8SQ0KH@ZP3A0kliwEEsvagcTU7e939APp3jVAoq9ZSUE3HQA "Japt ‚Äì Try It Online")
[Answer]
# [Husk](https://github.com/barbuz/Husk), 5 bytes
```
‚Üê‚ÜíkŒ£w
```
[Try it online!](https://tio.run/##yygtzv7//1HbhEdtk7LPLS7/////h/m9axTeL98IQQA "Husk ‚Äì Try It Online")
First time using `key-by`. Pretty fitting here.
## Explanation
```
‚Üê‚ÜíkŒ£w
      w split into words
    k   key on
     Œ£  sum of codepoints
 ‚Üí     take the last(maximum) key
‚Üê      return the first in the group
```
[Answer]
# Ruby, 45 characters
```
->s{s.split.max_by{|w|w.codepoints.reduce:+}}
```
Sample run:
```
irb(main):001:0> ->s{s.split.max_by{|w|w.codepoints.reduce:+}}['√†√† as a test']
=> "√†√†"
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1664ulivuCAns0QvN7EiPqmyuqa8plwvOT8ltSA/M6@kWK8oNaU0OdVKu7b2f0FpSbFCtHqiQpJCskKKQqq6joJ6RmpOTr5CeX5RTgqIW5KRWawARIkKJanFJSCRwwsOL1BIRBb5MH9Sg8KH@RN3A4klC4HEsnYgMXX7@x39QLp3DZDoawYpBOoqTlSPBbqsoLqmJLWipCYtGkTF1v4HAA "Ruby ‚Äì Try It Online")
### Ruby 2.4, 40 characters
```
->s{s.split.max_by{|w|w.codepoints.sum}}
```
(Untested.)
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 33 bytes
```
FHmCdmcd)Kczd aYu+GHmCdH0)@KxYeSY
```
[Try it online!](https://tio.run/##K6gsyfj/380j1zklNzlF0zu5KkUhMbJU2x0k4mGg6eBdEZkaHPn/v0dqTk6@Qnl@UU4KAA "Pyth ‚Äì Try It Online")
There is almost certainly a better way to do this, but I spent too much on it so this will do.
```
FH  #For every array of letters in
  mCd   #the array of arrays of letters [['w', 'o', 'r', 'l', 'd'], ['h', 'e', 'l', 'l', 'o']]
     mcd)   #wrap that in another array [[hello"], ["world"]]
         Kczd   #split input(z) on spaces ["hello", "world"] and assign it to K for later
              aY     #append to list Y... " " silences the prints from the for loop.
                u+GH    #reduce the list of numbers by summing them
                    mCdH    #convert each letter in the array to its int counterpart
                        0)    #the zero for the accumulator and close for loop
                          @K    #get by index the word from K
                            xY   #find the index in Y of that number
                              eSY   #sort Y, get the last (largest) number
```
I would have passed a reduce into another map instead of using the for loop, but I couldn't get that to work.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 20 bytes
```
‚âî‚™™Ôº≥ Œ∏‚âîÔº•Œ∏Œ£Ôº•Œπ‚ÑÖŒªŒ∑¬ßŒ∏‚åïŒ∑‚åàŒ∑
```
[Try it online!](https://tio.run/##LYtBCoMwEEX3nmJwNYH0BK7cFFxIC54gGDEDcRqTUbx9OpZ@Pp@/eG8OLs8fF2vtS6GVcUqRBAdOh0ySiVc0FlpodXfTNX9qdAl3C9Ox/S5ZeGVP7CJGo7EQlH2rLtjLwH65bvxJ7DFYGN1Fm6rhZrtaJVABrQNZijT1ccYv "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Explanation:
```
‚âî‚™™Ôº≥ Œ∏
```
Split the input string on spaces and assign to `q`.
```
‚âîÔº•Œ∏Œ£Ôº•Œπ‚ÑÖŒªŒ∑
```
Calculate the sum of the ordinals of the characters in each word and assign to `h`.
```
¬ßŒ∏‚åïŒ∑‚åàŒ∑
```
Find the index of the highest sum and print the word at that index.
[Answer]
# Powershell, 66 bytes
Straightforward. See [AdmBorkBork](https://codegolf.stackexchange.com/a/173430/80745)'s answer to found a smart using of Powershell.
```
-split$args|%{$s=0
$_|% t*y|%{$s+=$_}
if($s-gt$x){$w=$_;$x=$s}}
$w
```
*Note!* To correct work with unicode, save your script file with `UTF-16` or `UTF8 with BOM` encoding.
Test script:
```
$f = {
-split$args|%{$s=0         # split argument strings by whitespaces, for each word
$_|% t*y|%{$s+=$_}         # let $s is sum of unicode char code
if($s-gt$x){$w=$_;$x=$s}}  # if $s greater then previous one, store word and sum to variables
$w                         # return word from stored variable
}
@(
    ,("a b c d e", "e")
    ,("hello world", "world")
    ,("this is a test", "test")
    ,("√†√† as a test", "√†√†")
    ,("Œ± √§√§", "Œ±")
    ,("üç¨ Ôß±Ôß±Ôß±", "Ôß±Ôß±Ôß±")
    ,("üíÄ üëª ü§° ü¶á üï∑Ô∏è üç¨ üéÉ", "üï∑Ô∏è")
) | % {
    $s,$e=$_
    $r=&$f $s
    "$($r-eq$e): $r"
}
```
Output:
```
True: e
True: world
True: test
True: √†√†
True: Œ±
True: Ôß±Ôß±Ôß±
True: üï∑Ô∏è
```
]


[Question]
      [
Letters of the words want fairness.
They decided to appear same number of times in a sentence equally.
Example:
```
Priorities
```
Will become:
```
Ppprrioooritttieeesss
```
Each letter appears 3 times, as the most common letter was `i`, appearing 3 times.
It does not matter where you put the repeated letters, as long as they are next to a similar letter.
I.e.:
`Pppriooorritttieeesss` is OK (the 'r' letter)
`Ppprioororitttieeesss` is not OK (the 'r' letter)
Another example:
```
invoice
```
Will become:
```
innvvooiccee
```
Another example:
```
Remittance Advice
```
Will become:
```
Rrremmmiitttaannncce Adddvvvice
```
Space, comma, question mark, quotation, etc. are not considered letters for this challenge. Only need to consider [a-zA-Z]. Just once space is enough, and the order of the letters should remain the same.
The capitalization of letters does not matter, upper and lower case are countes as the same letter. That is: `Pip` has 2 'P's and 1 'I', so it will become `Piip`.
It is case insensitive letters can be in any form, `Piip=piip=piiP=PiiP`
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")

[Answer]
# [R](https://www.r-project.org/), 106 bytes
```
function(s){for(A in L<-LETTERS)s=sub(A,strrep(A,max(x<-+s-+Map(gsub,L,'',s,T))-x[A]--1),s,T);s}
"+"=nchar
```
[Try it online!](https://tio.run/##PcmxDoMgFIXh3acwLEKEoXN1YHCjibFuTQdKob2DYLhoTJo@OzVt0u1854/Ztdkt3iQIniJ7uRCpLMGXqhGqG8duODNscblRyTHFaOd9THqjWyNqFPVJz/SxZ654VXHkI2Niu8irEAf25RHfBalJ681Tx@wo6SOECAksElbsBr8GMPaHwU6QkvbGlvK@/u8eZsLyBw "R – Try It Online")
Base R approach :
* stealing some ideas from [@J.Doe R+stringr approach](https://codegolf.stackexchange.com/a/173341/41725), I saved 26 bytes !
* another 5 bytes saved using @J.Doe suggestion to abuse R `+` operator
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 16 bytes
```
lDáÙSÐ¹ls¢Zα>×.;
```
[Try it online!](https://tio.run/##ATIAzf9vc2FiaWX//2xEw6HDmVPDkMK5bHPColrOsT7Dly47//9SZW1pdHRhbmNlIEFkdmljZQ "05AB1E – Try It Online")
**Explanation**
```
l                  # convert input to lowercase
 D                 # duplicate
  á                # keep only letters
   Ù               # remove duplicates
    S              # split to list of chars
     Ð             # triplicate
      ¹ls¢         # count the occurrences of each letter in lowercase input
          Zα       # absolute valuue with max occurrence
            >      # increment
             ×     # repeat each unique char that many times
              .;   # replace the first occurrence of the char in lowercase input with this
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 82 bytes
*-3 bytes thanks to nwellnhof*
```
->\a{a.=lc.=subst($_,$_ x a.comb(/<:L>/).Bag.values.max+1-a.comb($_))for 'a'..'z'}
```
[Try it online!](https://tio.run/##LY7NC4IwGMbP@le8jNGUdNKlQ6ZQ5w7RORhva8bALzYVS/zbzUWHh@fjd3laZcr9Ur1hU0AGS5zfcUKelZJntn/YLqAiogJGQC6b6hEkx8MlT0J@xhcfsOyV5RWO213851SEYdEYYMg4Zx82L6nvOmmNbozutLIkAqLrodFSuXhTle46rKWC03P4jeSqWwKT762/KK6/qJNIfa8IKIarW3TEn5cv "Perl 6 – Try It Online")
Takes a mutable string and modifies it in place.
### Explanation:
```
->\a{        # Anonymous code block that takes a mutable string            }
 a.=lc;  # Lowercase
                                                               for 'a'..'z'  # For each letter
 .=subst(                                                    )  # Substitute
          $_,   #The first occurrence of the letter with
             $_ x  #The letter repeated
                  a.comb(/<:L>/).Bag.values.max    # The count of the most common letter
                                                 +1  # Plus 1
                                                   -a.comb($_)  # Minus the count of that letter already in the string
```
[Answer]
# JavaScript (ES6), 112 bytes
```
s=>(m=g=F=>s.replace(/[a-z]/gi,c=>F(c.toLowerCase())))(c=>g[c]=c+c.repeat(m-g[c]),g(c=>m=(n=g[c]=-~g[c])<m?m:n))
```
[Try it online!](https://tio.run/##bYu9CsIwFEZ3n8LNG@zPLt6KCJ0cxLV0CLe3IdIkJQkVHHz12NZN/MZzzveQkwzk9Rhz6zpOPaaAFRhUWGMVCs/jIImhbGT@akulM8KqBiqiu7on@4sMDGIezFw11CLtaXmxjGDyhYhMLdIgWFyL/L3iozmZgxUikbPBDVwMTkEPu5vXzuuoOeyE2PxIbSenif@YOxsdo7TE23M3fZv0AQ "JavaScript (Node.js) – Try It Online")
### Commented
```
s => (                       // s = input string
  m =                        // m = max. number of occurrences of the same letter
  g = F =>                   // g = helper function taking a callback function F
    s.replace(               //     (also used to store the # of occurrences of each letter)
      /[a-z]/gi,             //   for each letter c in s:
      c => F(                //     invoke F():
        c.toLowerCase()      //       with c.toLowerCase()
      )                      //     end of call to F()
    )                        //   end of replace()
)(c =>                       // invoke g() (second pass):
  g[c] =                     //   update g[c] to a non-numeric value
    c +                      //   append c once, unconditionally
    c.repeat(m - g[c]),      //   and append c as many times as required to reach m
                             //   (any subsequent iteration with the same letter will
                             //   lead to c.repeat(m - g[c]) --> c.repeat(NaN) --> '')
  g(c =>                     //   invoke g() (first pass):
    m = (n = g[c] = -~g[c])  //     increment g[c], save the result in n
      < m ? m : n            //     and update m to max(m, n)
  )                          //   end of first pass
)                            // end of second pass
```
[Answer]
# [J](http://jsoftware.com/), ~~33~~ ~~56~~ 46 bytes
```
t=:~:tolower
(#~1+t*~:(*>./-])t*1#.e.)@toupper
```
[Try it online!](https://tio.run/##HYyxCsIwFEX3fsXDDmmjRrtGUqKbi4i7g8QXjGhTkmcdpP31GnLgwoUD5zmfDgIWApgFJRmsYJSwhbSZlJwk@Zf/YiisklU5NUvik6x4Kzbra028KQWKWpP/9D2GnKqLmELAzsH54MhhZDt27AbvDKZ3wbcj4rfOIPwy@/uQ1JhhBZqH11a3EOc/ "J – Try It Online")
Couldn't find a way to avoid using `~:tolower` twice.
### How it works
```
t=:~:tolower    Auxiliary function: isupper
     tolower    Is lowercase version of itself...
   ~:           different from itself?
(#~1+t*~:(*>./-])t*1#.e.)@toupper    Main function
                          toupper    Convert to uppercase
                      e.     Build 2D array by comparing to itself
                   1#.       Row-wise sum; Count occurrences
                 t*     A) Filter by isupper (needed for finding max count)
           >./-]        Compute max of A) minus each element of A)
       ~:          Nub sieve; 1 if first occurrence, 0 otherwise
          *        Filter first occurrences only
     t*       Filter by isupper again, to ban non-alphabets from duplicating
   1+         Add one to preserve given chars
 #~           Duplicate
```
[Answer]
# [R](https://www.r-project.org/) + stringr, 108 bytes
I am not very good at `stringr`. Returns a mixture of lower and upper case since the question says it doesn't matter.
```
function(x){for(l in L<-letters)x=sub(l,strrep(l,max(s<-stringr::str_count(tolower(x),L))-s[L==l]+1),x,T);x}
```
[Try it online!](https://tio.run/##JcwxC8IwEIbh3V9ROiWYDK61Hdw7iLiJSI0XOYgXuVxrQPztMej2Pt/wcfG9LX4mJxhJZf32kVVokJqxtwFEgJPOQ5qvKpgkzPCs8ZiySr2tRrpz19W4uDiTKIkhvoDrkxm1tuk0DkM4rzfaZHPU2/wpXrV7xsgoCKnVq2qkJaKDPw7wQJGJHDS72/Kbyxc "R – Try It Online")
## Explanation
```
function(x){
for(l in letters){ # Iterate through builtin vector "a", "b", "c"...
   # Generate a 26-long integer vector for how many a's, b's, c's in lower case string
  s = stringr::str_count(tolower(x),letters)
    # Take the max of this
  m = max(s)
    # Repeat the letter in the iteration enough times to make the word 'fair'
  new.l = strrep(l,m-s[letters==l]+1)
    # Substitute the first instance only of the letter in the string for the repeated letter
    # This is case insensitive (the T at the end)
    # Notice we calculate the max letter frequency each loop
    # This is inefficient but doesn't change the answer and avoids bytes
  x=sub(l,new.l,x,T);
  }
x # Return the substituted string
}
```
[Answer]
# [K4](http://kx.com/download), 35 bytes
**Solution:**
```
{x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}
```
**Examples:**
```
q)k){x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}"Priorities"
"PPPrrioooritttieeesss"
q)k){x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}"invoice"
"innvvooiccee"
q)k){x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x}"Remittance Notice"
"RRRemmmiittaaanncce Noootice"
```
**Explanation:**
Might be golfable with a different approach, will keep thinking
```
{x@o@<o:(&^x),/(|/#:'g)#'g:" "_=_x} / the solution
{                                 } / lambda taking implicit argument x
                                _x  / lowercase input
                               =    / group
                           " "_     / drop space from keys
                         g:         / save as g
                       #'           / take each
               (      )             / do this together
                  #:'g              / count occurances in each group
                |/                  / take the maximum
             ,/                     / flatten with
        (&^x)                       / indices where input is null (ie " ")
      o:                            / save as o
     <                              / indices to sort o ascending
   o@                               / apply these to o
 x@                                 / apply these indices to original input
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~33~~ 32 bytes
```
⭆↧θ⁺§θκ×ι∧№βι∧⁼κ⌕↧θι⁻⌈Ｅβ№↧θλ№↧θι
```
[Try it online!](https://tio.run/##bY1BCsIwEEX3niLLCcQTuCqiIFgQ9QJjOujQJLVNUnv7OLWrgrMZ5s//79sXDrZDV8pl4JDglmQ9a3zDufvQYDES9Nqoi8sRqnQKDU3QG9WKdmdPEdioKjSw77LEH0ax1oty6DO6CK1RR5Zzzfu5ag5CrXFinz3MpZJfQGu307P930c4y@xKuZLnlDBYUlUzsqVN2Y7uCw "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
  θ                                 Input string
 ↧                                  Lower case
⭆                                   Map over characters and join
      κ                             Current index
     θ                              Input string
    §                               Original character
   ⁺                                Concatenate with
        ι                           Lowercased character
       ×                            Repeated
            ι                       Lowercased character
           β                        Lowercase alphabet
          №                         Count
         ∧                          Logical And
                   ι                Lowercased character
                  θ                 Input string
                 ↧                  Lower case
                ⌕                   Find
               κ                    Current index
              ⁼                     Equals
             ∧                      Logical And
                       β            Lowercase alphabet
                      Ｅ             Map over characters
                           λ        Current character
                          θ         Input string
                         ↧          Lower case
                        №           Count
                     ⌈              Maximum
                    ⁻               Minus
                               ι    Lowercased character
                              θ     Input string
                             ↧      Lower case
                            №       Count
                                    Implicitly print
```
[Answer]
# Java 11, ~~190~~ ~~176~~ 162 bytes
```
s->{s=s.toUpperCase();char m=2,i=64,a[]=new char[127];for(int c:s.getBytes())m-=m+~++a[c]>>-1;for(;++i<91;)s=s.replaceFirst(i+"",repeat((i+""),m-a[i]));return s;}
```
-14 bytes thanks to *@Nevay*.
Output is in full uppercase.
[Try it online.](https://tio.run/##hVFNT9wwEL3zK0a51FY@IKhq1aZZqSAqFakU9eOU5jDrHcAQO5E9WbRCy19fnKwB9VD1EnlmXt7Me@8W15jfru52qkPv4Rtq@3AAoC2Tu0JFcDGVAD/ZaXsNSsSHl1Xobw/CxzOyVnABFmrY@Xzx4GtfcP97GMidoichK3WDDkx9nOn63dsMm7a2dA9TtymP37fVVe9E2Anqoy@uiU82TF5IafLapI9pio1qF4u8nHFVmupPH8pKTmscDV0484t2noVOkyQLHUIWcyEzk2OjWykrRzw6C77a7qrp6mFcduHqePy61yswQXzU17SAMirfeCZT9CMXQxhxZ4UtlEgune6dZk0@kbMZ/4ZqG/gV/Rf3g4xmRhts/7xav/4x23x4CGdm7JBpBechNSjLmEoRJQcmCeghlvthNndFMA74hsCjIVgGe3PVj9NkSQpHTy@U2ts3DL2FX1@/w4b4NeCY/F/sYeamDYBmpttbFr2eIt7DxEvae1wrn4MTyZ@jJAssUeh29wQ) (NOTE: `String.repeat(int)` is emulated as `repeat(String,int)` for the same byte-count, because Java 11 isn't on TIO yet.)
**Explanation:**
```
s->{                      // Method with String as both parameter and return-type
  s=s.toUpperCase();      //  Convert the input-String to full uppercase
  char m=2,               //  Max occurrence (+1), starting at 2
       i=64,              //  Index integer, starting at 64 ('A'-1)
       a[]=new char[127]; //  Create a count-array of size 127 (printable ASCII chars)
  for(int c:s.getBytes()) //  Loop over the characters of the String as integers
    m-=m+~++a[c]>>-1;     //   Increase the occurrence-counter of the char by 1 first
                          //   And if it's larger than the max-2, increase the max by 1
  for(;++i<91;)           //  Loop `i` in the range ['A', 'Z']
    s=s.replaceFirst(i+"",//   Replace the first char `i` in the string with:
       (i+"").repeat(     //   That same character repeated
        m-a[i]));         //   The max(+1) minus its array-occurrence amount of times
  return s;}              //  Then return the now modified String as result
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 15 bytes
```
ḟ§Ë#f√MṘO´πL¹m_
```
[Try it online!](https://tio.run/##ASoA1f9odXNr///huJ/Cp8OLI2biiJpN4bmYT8K0z4BMwrltX////0JlIGJlZXM "Husk – Try It Online")
Brute force, so very slow.
## Explanation
```
ḟ§Ë#f√MṘO´πL¹m_  Implicit input, say s = "To do"
             m_  Convert to lowercase: t = "to do"
           L¹    Length of s: 5
         ´π      All length-5 combinations of [1..5]:
                   [[1,1,1,1,1], [1,1,1,1,2], [2,1,1,1,1], ..., [5,5,5,5,5]]
        O        Sort them lexicographically:
                   [[1,1,1,1,1], [1,1,1,1,2], [1,1,1,1,3], ..., [5,5,5,5,5]]
      MṘ         For each, replicate letters of t that many times:
                   ["to do", "to doo", "to dooo", ..., "tttttooooo     dddddooooo"]
ḟ                Find the first string that satisfies this:
                   Example argument: x = "tto ddo"
    f√             Letters of x: "ttoddo"
  Ë                They have equal
 § #               number of occurrences in x: true (all have 2).
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) `-h`, 27 bytes
*-3 bytes from @ETHproductions*
```
;v
ñ oC ó¥ ú £=iXÎpXèS)UbXg
```
---
**Trying to explain**
```
;v                          Convert implicit input to lowercase
ñ oC ó¥ ú £=iXÎpXèS)UbXg      Main function. Implicit lowercase input => "priorities"
ñ                           Sort => "eiiioprrst"
 oC                         Remove non alphabetical chars
   ó¥                       Split on different letters => ["e","iii","o","p","rr","s","t"]
     ú                      Right-pad each to the length of the longest with space => ["e  ","iii","o  ","p  ","rr ","s  ","t  "]
       £                    For each X in this array:
             XèS              Count the number of spaces in X
          XÎ                  Get the first character in X
            p   )             Repeat it (number of spaces) times
                              example the mapped value "e  " will become "ee"
         i                    Insert this into U at
                 UbXg           the first index of (first character in X) in U
        =                     Set U to the result
```
[Try it online!](https://tio.run/##AToAxf9qYXB0//87dgrDsSBvQyDDs8KlIMO6IMKjPWlYw45wWMOoUylVYlhn//8iUHJpb3JpdGllcyEiIC1o)
[Answer]
# [Ruby](https://www.ruby-lang.org/), 89 bytes
```
->s{1while(a=s.scan /\w/).map(&g=->x{s.scan(/#{x}/i).size}).uniq[1]&&s[a.min_by &g]*=2;s}
```
[Try it online!](https://tio.run/##bY5NC4JAGITv/oqFwI/IFbvGCv2DiG4msdqmL@Rq@65fqb/dDCk6NMxhZg4Po6q4m25scgPs/SaDu7A5Q4oJl8Q7N55Dc17aZsrcoO2X3fZWfTt64FCEpxgdWkl4hH5kmhhymoO8xB0x02jNtjscp9A6ZYBkNidaoLY21kFBoUCDwLmArAtIxJyOIgetuUwE2V/rZeNkVmxF7xv9oIay0khuoYrG6RdjfDHGH4zxwbwA "Ruby – Try It Online")
I tried different approaches, but what really saves a lot of bytes is adding one character at a time.
### How:
```
->s{
    1while                             # 1 is a nop to the while
    (a=s.scan /\w/)                    # For all the letters in the string
    .map(&g=->x{s.scan(/#{x}/i).size}) # Count occurrences ignoring case.
    .uniq[1]                           # Break out of loop if all equals
    &&s[a.min_by &g]*=2                # Otherwise duplicate the letter
                                       #  with the lowest count
    ;s}                                # Return the string
```
[Answer]
# Powershell 6, 123 bytes
*It uses a char range `'a'..'z'`. See script for previous Powershell below.*
```
param($s)for(;'a'..'z'|%{
if($d=($s-replace"[^$_]").Length-$n){if($d-gt0){1}else{$s=$s-replace"^(.*$_)","`$1$_"}}}){$n++}$s
```
Explained test script:
```
$f = {
param($s)                               # a parameter string
for(;                                   # loop while exists at least one letter...
'a'..'z'|%{                             # for each letter
    $d=($s-replace"[^$_]").Length-$n    # let $d is a difference between a number of current letter and current $n
    if($d-gt0){                         # if the difference > 0
        1                               # then return a object to increase $n on next iteration
    }
    if($d-lt0){                         # if the differenct < 0
        $s=$s-replace"^(.*$_)","`$1$_"  # append the current letter after a last instance of the letter. Use "^(.*?$_)" regexp to append it after a first instance of the letter.
    }
}){
    $n++                                # increment $n if exists at least one letter number of witch greather then $n
}                                       # and make next iteration of the 'for'.
$s                                      # return modified string if all letters in the string occur the same number of times
}
@(
    ,('Priorities', 'Ppprrioooritttieeesss', 'PPPriooorritttieeesss')
    ,('invoice', 'innvvooiccee')
    ,('Remittance Advice', 'Rrremmmiitttaannncce Adddvvvice', 'RRRemmmitttannnce Aadddvvviicce')
) | % {
    $s,$e = $_
    $r = &$f $s
    "$($r-in$e): $r"
}
```
Output:
```
True: Pppriooorritttieeesss
True: innvvooiccee
True: Rrremmmitttannnce Aadddvvviicce
```
# Powershell 5.1-, 133 bytes
```
param($s)for(;97..122|%{$_=[char]$_
if($d=($s-replace"[^$_]").Length-$n){if($d-gt0){1}else{$s=$s-replace"^(.*$_)","`$1$_"}}}){$n++}$s
```
[Answer]
# [Red](http://www.red-lang.org), 252 bytes
```
func[s][a: charset[#"a"-#"z"#"A"-#"Z"]t: parse s[collect[any[keep a | skip]]]m: copy
#()foreach c t[c: form c either n: m/:c[m/:c: n + 1][m/:c: 1]]d: last sort extract next
to-block m 2 foreach c s[prin c: form c if n: m/:c[loop d - n[prin c]m/:c: d]]]
```
[Try it online!](https://tio.run/##TY5NasMwEIX3PsVD3rQUU9KldrlByTJCC3U0xsK2JKRpaErv7so0JN0M72eYbwr77cTe2G7U2/gZyVRrnAZNrlQW0yunhl59q14dd3FWVjTyXqIaSsvCJMbFq5mZMxx@UOeQrbVrO5LyteufnsdU2NEEghjSaHZtmoNMXBA11ldNZh8aES842Js5WOs1FlcFNRUBf0lxJIhNdJKGjyXRjBVveBCqySVEPDBhvCOWlDI8BsTbkv3j@PbutieCEeq9hFSCBK6qu4chXlIg/peceA0iLhLj6C97t/0C "Red – Try It Online")
Ridiculously long solution...
## Explanation:
```
f: func [ s ] [
    a: charset [ #"a" - #"z" #"A" - #"Z" ]   ; letters
    t: parse s [                             ; parse the string
        collect [ any [ keep a | skip ] ]    ; and keep only the letters
    ]
    m: copy #()                              ; initialize a map
    foreach c t [                            ; for each character in t
        c: form c                            ; the character as a string
        either n: select m c [ m/:c: n + 1 ] ; increase the count if already in map
                             [ m/:c: 1 ]     ; otherwise create a map entry with count 1
    ]
    d: last sort extract next to-block m 2   ; convert the map to a block; extract only the
                                             ; numbers and take the last of the sorted block
    foreach c s [                            ; for each character in the input
        c: form c                            ; the character as a string
        prin c                               ; print it (with no space nor newline)
        if n: select m c [                   ; if c is a key in the map
            loop d - n [ prin c ]            ; print the character again up to d times
            m/:c: d                          ; set the count to max (flag it as used)
        ]
    ]
]
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~140~~ 137 bytes
```
x=>[...x=x.toLowerCase()].map(F=c=>(F[c]=-~F[c],F[c]>w?w=F[c]:w,c),w=0).map(c=>x=x.replace(c,c.repeat(c>'`'&c<'{'?w-F[c]+1:1),F[c]=w))&&x
```
[Try it online!](https://tio.run/##bYxBC4JAFITv/YrooLukS16tp4fAU4fuIrQ8n7GhrqyLKwT9dWvtFl1mBuabechJjmjUYONe17Q0sMyQlUKIGWZh9UU7Mmc5EuOV6OTACkDIWFFiBfHLW@Qlc7kDH1IXIY8cHPhKf1j/Y2hoJRLDCH0maRlm4S0M8BQ@w9zFfrpP0oSvb@A4D4J5OaLuR92SaPWdNWx3NUobZRWNO843v63qJ62Q/lWGOmWt7JG2sp6@0PIG "JavaScript (Node.js) – Try It Online")
+33 bytes from my first solution for those never-ending additional constraints. JS sucks at case-insensitive string manipulations you know.
-3 bytes back Thanks @Arnauld.
## Explanation
```
x =>                                     // The function.
  [...x = x.toLowerCase()].map(f = c => (// - Iterate among each character...
                                         // - Additional constraint 2
    f[c] = -~f[c],                       //   - Add one to the character counter
    f[c] > w ? w = f[c] : w,             //   - Update the maximum count if necessary
    c                                    //   - Return back the character for the use in
                                         //     the next map function
  ), w = 0)                              // - The counters
  .map(c =>                              // - Iterate again...
    x = x.replace(                       //   - Repeat the first appearance of
      c,                                 //   - Each character
      c.repeat(                          //   - Needed number times
        c > '`' & c < '{'                //   - Additional constraint 1
        ? w - f[c] + 1                   //   - If this is letter, repeat
        : 1                              //   - If not, stay as is
      ),                                 //   - That should've been clearly stated
      f[c] = w                           //   - And set the counter so that no further
                                         //     replacements are done on this character
    )                                    //   - (w - f[c] + 1 = 1 in further iterations)
  ) && x                                 // - Return the result
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~77~~ 70 bytes
```
{s:i|$($!.min(*{*}).key)|$/$/|until [==] ($!=.lc.comb(/<:L>/).Bag){*}}
```
[Try it online!](https://tio.run/##FY6xCsIwFEXn9iueEGxSJN0crBF0dhBXEakxlYdNIkkslLbfHtPpXg7nwv0q122jHmDdgoij3@FEKFlxjYaWYzkz/lEDm0hFqulnAnZwE@IOSRG8k1xa/aTVfnc@VIyfmjdLkzm21kFxcWgdBlS@2ECBprco1VKvSmMIjZEKjq9@gTDmWbpAPAggjzrPWko8S@mbhdb5HP8 "Perl 6 – Try It Online")
Taking G B's approach of inserting a character until all characters appear the same number of times. Receives a string that is modified in-place.
If underscores can be treated like letters, the regex can become `/\w/`, saving two bytes.
### Explanation
```
{
                    .lc.comb(/<:L>/).Bag          # Create Bag of letter/count pairs
                ($!=                    )         # Store temporarily in $!
 ... until [==]                          .values  # Until all counts are equal
 s:i|                      |    |                 # Replace (ignoring case)
     $($!.min(*.value).key)                       # letter with minimum count
                            $/$/                  # with itself doubled
}
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~97~~ 117 bytes
```
s=input().upper()
S=''
for c in s:S+=c+c*(max(map(s.count,map(chr,range(65,91))))-(S+s).count(c))*('@'<c<'[')
print S
```
[Try it online!](https://tio.run/##JY7BCsIwEETv@YrQyyZtLSgqKC3oH4g9eqrravfQJCRpqV9fU3wwMAwDM@4be2t2C9oXNVmWLaFh48aodDU6R15p0TYA4m29RMlGhnNbNFhgroZuTnIqVGhHE8vVY@9L35kPqeOhPG11YqPaIuh/R6HWuYIL1FjDA7Rwnk2U7ZKWBc2Ecv2R7xe4ebaeI1MAAWwmy0jJ3WngGDuDJK@v6Z91MvGEHw "Python 2 – Try It Online")
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~246~~ ~~223~~ ~~220~~ ~~210~~ ~~208~~ ~~193~~ 188 bytes
Compiler flag `-DF=;for(i=0;b[i];i++` `-DB=b[i]` (29 bytes)
Added mixed case support.
```
f(char*c){char m,i,s,*b,a[255]={0};s=asprintf(&b,c)F)B=tolower(B),a[B]++F,a[B]>a[m]?m=B:0)F)a[B]^a[m]?b=realloc(b,s+i),bcopy(&B,b+i+1,s),a[B]++:(m=B);puts(b);}
```
[Try it online!](https://tio.run/##NY5da8MgFIb/SulF0WohG/Sm4kal5HrsNmSgTtsDGoO6jhHy1@dMw67eD55zePVBOzlcS7FI32TcazwtuvEUaKJ7RWX3fDz2fGpmlrhMY4QhW7RTVOMWC56DC98mIoErKXpC2oe@yM73r56LU1Oxpfl4NIpHI50LGimaCGCqdBh/0E5QRYA80fT/5oTqMWbjV05IYTYXL2FAeLJoC8M9gDZbzGqoe0KEDCat@Q3G1bwbDznLQZvN@fO@8nP51dbJayqHi@Cqg76aljMbIgLesKVhQMgf "C (clang) – Try It Online")
[Answer]
# Pyth, ~~31~~ 30 bytes
```
JeSm/Qd=r0QVQ=tQ=+k*N-J/+kQN)k
```
[Try it here](http://pyth.herokuapp.com/?code=JeSm%2FQd%3Dr0QVQ%3DtQ%3D%2Bk%2aN-J%2F%2BkQN%29k&input=%22Priorities%22&debug=0)
### Explanation
```
JeSm/Qd=r0QVQ=tQ=+k*N-J/+kQN)k
       =r0Q                        Convert input to lowercase.
JeSm/Qd                            Find the count of the most common character.
           VQ               )      For each character in the input...
             =tQ                   ... remove that character from the input...
                =+k*N-J/+kQN       ... append copies to k until we have enough.
                             k     Output.
```
[Answer]
# [C (GCC)](https://www.gnu.org/software/gcc/) - 175 Bytes
```
f(char*s){int c[999]={0},i=0,m=0,k,L;while((L=s[i++])&&(k=++c[L<97?L+32:L]))m=k>m?k:m;i=0;while(L=s[i++])for(L=L<97&&L>64?L+32:L,putchar(L);isalpha(L)&&++c[L]<=m;)putchar(L);}
```
**Ungolfed**
```
f(char *s) {
  int c[999]={0},i=0,m=0,k,L;                      // Array used like a dictionary, temp vars
  while((L=s[i++])&&(k=++c[L<97?L+32:L]))          // store letter counts
    m=k>m?k:m;                                     // calculate max occurance
  i=0;                                             // reset string index
  while(L=s[i++])                                  // iterate string
    for(L=L<97&&L>64?L+32:L,putchar(L);isalpha(L)&&++c[L]<=m;) // set character L to lowercase if in alphabet, print always once, repeat if in alphabet
      putchar(L);                                  // print character
}
```
[Try it online!](https://tio.run/##dY4xT8MwEIX3/goTkGXjIEWAqFLXjRiRPCDWkCEyTnNK7FS2W4Yovz04UBBLh5Pe3b3v6am7vVLz3BDV1u7W0xFsQKrM87wSYzalILLUxOlSyT9b6DUhUvgSGKsoxqQTjKlSbvN1IdnD/UZWlBrR7UzRbQyP8Bn6Y5rBxWUBMJa7p8czlh6OYWlAJOXg6/7Q1lFi/J1ebYXh9J9jmpeWpgZLKBpXCDUkebGnAZR@zxLK4yW6PUl@dPy@OhgcBND@guFNGwihtkqj54/T5SA1DD1aenhUXF3f/LqcDkdnUcZX0/wF)
[Answer]
**Kotlin Android, 413 bytes**
```
var l: List<Char> = w.toList().distinct();val h = HashMap<Char, Int>();var x='m';var n=0;for(z in l.indices){var c=0;for (i in 0.rangeTo(w.length-1)){if(l[z]==(w[i]))c++};h.put(l[z],c);if(n<c){n=c}};for(entry in h){h.replace(entry.key,n-entry.value)};var v=ArrayList<Char>();for(i  in 0.rangeTo(w.length-1)){if(h.containsKey(w[i])){for(p in 0.rangeTo(h.get(w[i])!!)){v.add(w[i])};h.remove(w[i])}else{v.add(w[i])}}
```
[Try online](http://rextester.com/live/PCPID64484)
Explanation
step 1 --> Select list of distinct chars.
step 2 --> Get count of every char in string and select max char frequency.
step 3 --> get difference in frequency of chars with respect to max char frequency
step 4 --> place chars with respect to positions in string.
Happy Solving !
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 145 bytes
```
x=>x.ToLower().Select((a,b)=>x.IndexOf(a)==b&char.IsLetter(a)?a+new String(a,x.GroupBy(d=>x.Count(e=>e==d)).Max(d=>d.Key)-x.Count(d=>d==a)):a+"")
```
[Try it online!](https://tio.run/##hY7BTsMwEETvfEWVA/KqrT8AcKpSQRURBKJIPW/spVhq15W9oe7Xh7jAmevMe6OxaW6THx57tndJoufdrHng/kARuz39RnUtlMQM2dRZv4c2nCgq0BvakxWlcNZBaRp2lF8@FIIx3bX9xKib1JLISCMscMp0mmwui6OT9TqG/nh/Vq7Iq9CzKDI1GeMA9DPmUjj9RGeY//UlMQYBbnBaVTDcXm2jF2o9k/r5OoJsUVR5rKrX6MMIeEoVAPxHv9HBiyBbmizdl7d0kYZv "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [PHP](https://php.net/), ~~185~~ ~~173~~ 170 bytes
```
function($s){$m=max($a=count_chars($s=strtolower($s),1));foreach(str_split($s)as$c)$o.=str_repeat($c,($b=$a[$d=ord($c)])!=($a[$d]=$m)&&$d>96&&$d<123?$m-$b+1:1);return$o;}
```
[Try it online!](https://tio.run/##PZBhS8MwEIY/218Ry7EmWMUqCNplw38w/DrHyNLUBtZcuNymIP72mg70073v897xwsUhTst1HKJwREh7chGJffiQ96oV0As99adg2WOQkNQ3jHo0XxKMtngKvLeDoZQTnZgYj/jpaN6rG6XaHskZO8gc7VM8ep4Tk8AqwLv5YG5zJmNbSzhoMFvoNFKXgdqpay0vZKdhVIsFdKvnp3ksm4fHNYy3cLhpXhrVkuMTBcD2Z/qvFNviqtqQR/LsXarqbH04o7fuot/c6JlNsE68duc/uvGxKnbCJAEsVOHsgFnVohR6Jco6v0MCq@zfQ9lOvw "PHP – Try It Online")
Ungolfed (and un-ternaried and un-optimized).
```
function f($s) {
    $s = strtolower( $s );
    $a = count_chars( $s, 1 );
    $m = max( $a );
    foreach( str_split( $s ) as $c ) {
        if ( $c < 'a' or $c > 'z') {           // is non a-z
            $n = 1;
        } elseif ( $a[ord($c)] == $m ) {    // already has max number
            $n = 1;
        } else {
            $n = $m - $a[ord($c)] + 1;       // add this many chars
        }
        $o .= str_repeat( $c, $n );
        $a[ord($c)] = $m;                   // has reached the max
    }
    return $o;
}
```
]


[Question]
      [
Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.
So the end-result becomes:
```
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn
```

[Answer]
# [Stax](https://github.com/tomtheisen/stax), 12 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ü¡│\½◙S·«═▓╞
```
[Run and debug it](https://staxlang.xyz/#p=81adb35cab0a53faaecdb2c6&i=&a=1)
Unpacked, ungolfed, and commented, it looks like this.
```
`Mwys-` compressed literal "conemon"
m       for each character output the result after running the rest of the program
 ]      wrap in singleton array
 iHA+   `2 * i + 10` where i is the 0-based iteration index
 *      repeat array
```
[Run this one](https://staxlang.xyz/#c=%60Mwys-%60%09compressed+literal+%22conemon%22%0Am++++++%09for+each+character+output+the+result+after+running+the+rest+of+the+program%0A+]+++++%09wrap+in+singleton+array%0A+iHA%2B++%09%602+*+i+%2B+10%60+where+i+is+the+0-based+iteration+index%0A+*+++++%09repeat+array&i=&a=1)
[Answer]
# [Z80Golf](https://github.com/lynn/z80golf), ~~35~~ 31 bytes
```
00000000: 2118 0016 0a42 7efe 0028 0cff 10f8 3e0a  !....B~..(....>.
00000010: ff23 1414 4218 ef76 636f 6e65 6d6f 6e    .#..B..vconemon
```
[Try it online!](https://tio.run/##LYwrEgJBDAU9p3gUBpVKMkN2CoHgJltLgoEdh0Bw9SF8WvV7op@Nr/0WY/CfI1SkgVkMPFfF5OE5Nb8lAsLRUJxnYEvJ@UW0/8iJNr@CZCNCC6RKRdWseUwGKxYwtwPs8jUktMsE0WPpq9/7OsYb "Z80Golf – Try It Online")
Assembly:
```
ld hl,str
ld d, 10
ld b, d
loop:
	ld a,(hl)
	cp 0
	jr z, hlt
	rst 38h; putchar
	djnz loop
ld a, 10; newline
rst 38h
inc hl
inc d
inc d
ld b, d
jr loop
hlt:
	halt
str:
	db 'conemon'
```
-4 bytes changed `call 8000h` to `rst 38h`
[Answer]
# [PHP], 76 bytes
```
$i=8;foreach(str_split("conemon") as $k){$i+=2;echo str_repeat($k,$i)."\n";}
```
[Try it online](http://sandbox.onlinephpfunctions.com/code/a5543471b0d530154eb2fc3a7d7ecaa96da37b05)
[Answer]
# [Z80Golf](https://github.com/lynn/z80golf), 23 bytes
```
00000000: 0907 060d 0507 0676 1a3c 473c 127e ee68  .......v.<G<.~.h
00000010: ff10 fd3e 0a23 e5                        ...>.#.
```
[Try it online!](https://tio.run/##dYwxDkBAFER7p5hE/zNr2UVE6xzCXwqJTqFw9bVB6xWTad47ay77FmLkRws29KDjDFbP8w5mtBNKn8YUXqHqakBeDumGTi5Zs7dgUiMEQ4TZKjgWFlrhh@T3kkuMNw "Z80Golf – Try It Online")
### Disassembly
```
start:
  add hl, bc ; db ('c'^$68)-2
  rlca       ; db 'o'^$68
  ld b, $0d  ; db 'n'^$68
             ; db 'e'^$68
  dec b      ; db 'm'^$68
  rlca       ; db 'o'^$68
  ld b, $76  ; db 'n'^$68
             ; halt
  ld a, (de) ; manipulate the byte at address 0
  inc a
  ld b, a    ; loop count
  inc a
  ld (de), a ; save +2 of previous
  ld a, (hl)
  xor $68    ; the char to print
loop:
  rst $38    ; print it `b` times
  djnz loop
  ld a, $0a  ; newline to print
  inc hl     ; string index & return address
  push hl
```
The [Hello World trick](https://codegolf.stackexchange.com/a/166951/78410) strikes again. The first byte is also used to track the loop count.
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 26 bytes
```
7:a;"conemon"{{.}a)):a*n}%
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPn/39wq0VopOT8vNTc/T6m6Wq82UVPTKlErr1b1/38A "GolfScript – Try It Online")
I'm surprised nobody else has done a solution in this language by now. However, I won't be surprised when this submission is eventually beaten.
[Answer]
# APL(NARS), 19 chars, 38 bytes
```
⊃'conemon'/¨⍨2×4+⍳7
```
test:
```
  ⊃'conemon'/¨⍨2×4+⍳7
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
oooooooooooooooooooo
nnnnnnnnnnnnnnnnnnnnnn
```
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~36~~ 34 bytes
*-2 bytes thanks to nwellnhof*
```
("conemon".comb Zx(5..*X*2))>>.say
```
[Try it online!](https://tio.run/##K0gtyjH7/19DKTk/LzU3P09JLzk/N0khqkLDVE9PK0LLSFPTzk6vOLHy/38A "Perl 6 – Try It Online")
### Explanation:
```
 "conemon".comb                     # Get conemon as a list of characters
                   5..*             # A lazy list from 5 to infinity
                       X*2          # Multiplied by 2
                                    # This results in the list 10,12,14 etc.
                Zx                  # Zip the two together with the string multiplication operator
                                    # This multiplies each character by 10, 12 etc.
                            >>.say  # Print each line
```
[Answer]
# [Perl 5](https://www.perl.org/), 33 bytes
```
conemon=~s/./say$&x(8+2*++$i)/reg
```
[Try it online!](https://tio.run/##K0gtyjH9/z85Py81Nz/Ptq5YX0@/OLFSRa1Cw0LbSEtbWyVTU78oNf3//3/5BSWZ@XnF/3V9TfUMDA0A "Perl 5 – Try It Online")
### Explanation
```
         s/ /                /     # Replace
                                g  # each
           .                       # character
       =~                          # in
conemon                            # string "conemon"
                              r    # non-destructively (source is read-only)
                               e   # only for the side effect of
             say                   # printing with newline
                $&                 # the full match (character)
                  x                # repeated
                        ++$i       # 1,2,3,...
                      2*           # 2,4,6,...
                    8+             # 10,12,14,...
                   (        )      # times
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 17 bytes
```
"conemon"¬Ëp°EÑ+8
```
[Try it online!](https://tio.run/##y0osKPn/Xyk5Py81Nz9P6dCaw90Fhza4Hp6obfH/v24QAA "Japt – Try It Online")
---
# [Japt](https://github.com/ETHproductions/japt), 14 bytes
```
`¬¶n`¬Ëp°EÑ+8
```
[Try it online!](https://tio.run/##y0osKPn/P@HQmkOzDm3LA9KHuwsObXA9PFHb4v9/3SAA)
---
**Explanation**
```
"conemon"¬Ëp°EÑ+8           Full Program
"conemon"¬                  Split each letter
          Ëp                Map and repeat
            °EÑ+8           ((1 + Index) * 2) + 8
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 56 bytes
```
[..."conemon"].map((e,i)=>console.log(e.repeat(i*2+10)))
```
[Try it online!](https://tio.run/##Dcg7DoAgDADQuzi1fhp114sYhwYbgwFKgHj96hvfwy9XV3xuU9JLzA4i6pwmiZq6kyJnABk9bvufVYNQ0BuEimThBr5fh2VGRLMP "JavaScript (Node.js) – Try It Online")
[Answer]
**PowerShell**, 46 bytes
```
$i=8;'c','o','n','e','m','o','n'|%{$_*($i+=2)}
# $i=8;foreach($c in [char[]]'conemon'){[string]$c*($i+=2)}
```
[Answer]
# [///](https://esolangs.org/wiki////), 74 bytes
```
/E/eeee//M/mmm//N/nnnn//O/oooo//;/OOO
NNNnn/cccccccccc
;
EEEE
MMMMMM
OO;NN
```
[Try it online!](https://tio.run/##PcixDYBACEDRnmX@ANRXHsxwMZdYiBbsHyQWvvLltfLcWcVgN5hEBBh3A@dpoLi7mFnn8ROV0WR@xF3Nql4 "/// – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 29 bytes
```
K`conemon
L$`.
$.(5*_$`)*2*$&
```
[Try it online!](https://tio.run/##K0otycxLNPz/3zshOT8vNTc/j8tHJUGPS0VPw1QrXiVBU8tIS0Xt/38A "Retina – Try It Online") Explanation:
```
K`conemon
```
Initialise the buffer with the text.
```
L$`.
```
Loop over each character and output each substituion on its own line.
```
$.(5*_$`)*2*$&
```
Repeat the match (5 + index) \* 2 times.
[Answer]
# [LUA](https://www.lua.org/manual/5.1/), 67 66 bytes
```
s="conemon"
l=10
for i in s:gmatch'.'do print(i.rep(i,l))l=l+2 end
```
[Try it online.](https://tio.run/##yylN/P@/2FYpOT8vNTc/T0khx9bQgCstv0ghUyEzT6HYKj03sSQ5Q11PPSVfoaAoM69EI1OvKLVAI1MnR1MTqDpH20ghNS/l/38A)
[Answer]
# [Deadfish~](https://github.com/TryItOnline/deadfish-), 129 bytes
```
{{i}}d{c}{{d}i}ic{{i}}i{c}cc{{d}}dc{{i}}{c}cccc{{d}}c{{i}d}i{c}cccccc{{d}i}dc{{i}}d{c}cccccccc{{d}}ic{{i}}i{cc}{{d}}dc{{i}}{cc}cc
```
[Try it online!](https://tio.run/##Rc0xDsAgDEPRE/VQVUxVz4yRz56WEGB9@rLRbjzs7xXhTglucocoWgJ/MBskTEkoSkFFS7lKbK78bM6XMznCiA8 "Deadfish~ – Try It Online")
]