Если покороче, то вот:
$c1=13
$c2=24
$c3=35
$c4=4
$c5=21
$c6=14
$c7=16
$c8=27
$c9=26
$c10=5
$string=STRCONCAT($c1,":",$c2,":",$c3,":",$c4,":",$c5,":",$c6,":",$c7,":",$c8,":",$c9,":",$c10)
GOSUB(max_opred)
$max1=$max
GOSUB(max_opred)
$max2=$max
GOSUB(max_opred)
$max3=$max
LOGWRITE ("max1= ",$max1,", max2= ",$max2,", max3= ",$max3)
HALT
SUB(max_opred)
$cut=$string
$max=0
WHILE(INT(STRPOS($cut,":"))!0)
$num=INT(STRCUT2($cut,1,STRPOS($cut,":")-1))
$cut=STRCUT2($cut,STRPOS($cut,":")+1,99999)
IF($num > $max)
$max=$num
END_IF
END_CYC
IF(INT($cut) > $max)
$max=INT($cut)
END_IF
IF(STRPOS($string,$max)=1)
$string=STRREPLACE($string, STRCONCAT($max,":"), "")
ELSE
$string=STRREPLACE($string, STRCONCAT(":",$max), "")
END_IF
END_SUB
Здесь при увеличении количества переменных будет расти только длина строки
$string=STRCONCAT($c1,":",$c2,":",$c3,":",$c4,":",$c5,":",$c6,":",$c7,":",$c8,":",$c9,":",$c10)
Длина всегда 29 строк против 72 для 10 переменных, если больше-строк больше.