Largest int from concatenated ints: Difference between revisions

→‎Vim Script: Add implementation
(added php)
(→‎Vim Script: Add implementation)
Line 326:
[54 546 548 60] => [60 548 546 54] (concatenated: 6054854654)
</pre>
 
=={{header|Vim Script}}==
This solution is intended to be run as an Ex command within a buffer containing the integers to be processed, one per line.
<lang Vim>%s/\(.\+\)/\1\1/ | sort! | %s/\(.\+\)\1\n/\1/</lang>
 
;Demonstration
 
<lang Bash>$ paste -s nums
1 34 3 98 9 76 45 4
$ vim -S icsort.vim nums
998764543431</lang>