from typing import Dict


def convert_str_based_on_rules(s: str, rules: Dict[str, str]) -> str:
    """Converts a string based on a dictionary with rules where each key is changed to val."""
    
    return rules[s] if s in rules else s