------
## 最终结论
```python
def get_min_encoded_length(s: str, k: int) -> int:
    n = len(s)
    dp = [[float('inf')] * (k + 1) for _ in range(n + 1)]
    dp[0][0] = 0  # Base case: no characters and no deletions has a length of 0

    for i in range(1, n + 1):
        for j in range(k + 1):
            count = 1
            for p in range(i - 1, -1, -1):
                if p < i - 1 and s[p] == s[i - 1]:
                    count += 1
                if count > 1:
                    length_increase = len(str(count)) + 1
                else:
                    length_increase = 1

                if j >= (i - p - 1):
                    dp[i][j] = min(dp[i][j], dp[p][j - (i - p - 1)] + length_increase)
                else:
                    break

            # Case where we delete the current character
            if j > 0:
                dp[i][j] = min(dp[i][j], dp[i - 1][j - 1])

    return min(dp[n])

# Example usage:
print(get_min_encoded_length("aaabcccd", 2)) # Output: 4
print(get_min_encoded_length("aabbaa", 2))   # Output: 2
print(get_min_encoded_length("aaaaaaaaaaa", 0)) # Output: 3
```