Write a program that finds the most occurring paired letter in a string
Bash + GNU coreutils, 133

grep -Eo '([A-Z])\1+'&lt;&lt;&lt;"${1^^}"|cut -c1|sort|uniq -c|sort -rn|while read n l
do((a-n&amp;&amp;a-0))&amp;&amp;exit||echo $l&amp;&amp;a=$n
done|sort|tr -d \\n


Testcases:

$ for t in "Sally's friend Bobby searched for seashells." \
&gt; "Sally's friends Jimmy and Bobby rummaged for seashells." \
&gt; "willless" \
&gt; "Sally's sociable friends Sammy and Bobby searched for fabulous seashells." \
&gt; "11ss11aa"
&gt; do
&gt; ./mostpaired.sh "$t"
&gt; echo
&gt; done
L
LM
LS
L
AS
$