27 lines
364 B
Bash
Executable File
27 lines
364 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
max1=0
|
|
max2=0
|
|
max3=0
|
|
c=0
|
|
|
|
while read a; do
|
|
if [[ -n "$a" ]]; then
|
|
let c+=$a
|
|
else
|
|
if [[ $c -gt $max1 ]]; then
|
|
max3=$max2
|
|
max2=$max1
|
|
max1=$c
|
|
elif [[ $c -gt $max2 ]]; then
|
|
max3=$max2
|
|
max2=$c
|
|
elif [[ $c -gt $max3 ]]; then
|
|
max3=$c
|
|
fi
|
|
c=0
|
|
fi
|
|
done
|
|
|
|
echo $(( $max1 + $max2 + $max3 ))
|