Vyxal, 95 91 9155 bytes
@i|¥‛--oṘλ2ẇ«½∇«:\irß›,;Ẋ«∨uOŻN€bMċ∇Dk«⌈Ŀṅ\e/:£L‹(¥2wiL‹\e*$ṅ+;Ẋ‛eeo:\\erß›\e\-$r[@i;Q|Dh$t=[¥2ȯ‹|:«ƛẆ°«r[t«½∇«:1ǓĿ¥2ȯ+|t«½∇«:1ǔĿ¥2ȯ+‹]]£])@iV
The messiest mess I've ever madePartially ported ovs. EvenDo I don't really understand it...
This goes through the first two characters of the string repeatedly, 'bubbling' -s to the end and eventually replacing double -s with nothing, then adding in ones if necessary.win 'Most improved'?
Borrowed a trick from @ovs by checking if the result isMakes a substring of -
lot more sense now.
λ ; # Lambda
2ẇ # Chunks of 2
«½∇« # Compressed `ijk`
:Ẋ # Cartesian square
«∨uOŻN€bMċ∇Dk« # Compressed string `e k ej ek e i j ei e`
⌈ # Split by spaces
Ŀ # Transliterate
ṅ # Join
\e/ # Split by `e`
: # Duplicate
L‹\e* # (Length - 1) es
$ṅ+ # Prepended (so es are bubbled to start
Ẋ # Repeat on input until result doesn't change
‛eeo # Get rid of double es
:\erß # If result is a substring of 'e'
› # Append a 1
\e\-V # Replace es with -s