------
## 最终结论
```python
def mask_email(email):
    local, domain = email.split('@')
    local = local.lower()
    domain = domain.lower()
    return f"{local[0]}*****{local[-1]}@{domain}"

def mask_phone(phone):
    digits = [c for c in phone if c.isdigit()]
    local_number = "***-***-" + "".join(digits[-4:])
    if len(digits) > 10:
        country_code = "+" + "*" * (len(digits) - 10)
        return f"{country_code}-{local_number}"
    else:
        return local_number

def check_type(S: str) -> str:
    if '@' in S:
        return "email"
    else:
        return "phone"

def mask_personal_info(S: str) -> str:
    if check_type(S) == "email":
        return mask_email(S)
    else:
        return mask_phone(S)

# Example usage:
# print(mask_personal_info("LeetCode@LeetCode.com"))  # Output: "l*****e@leetcode.com"
# print(mask_personal_info("1(234)567-890"))          # Output: "***-***-7890"
```