```python
def strip_ends(text: str, mark: str) -> str:
    """The text with all occurrences of a character removed from both of its ends."""
    if not text or not mark:
        return text
    
    # Strip leading characters
    while text.startswith(mark):
        text = text[1:]
    
    # Strip trailing characters
    while text.endswith(mark):
        text = text[:-1]
    
    return text
```