```python
import collections

def rearange_string(S):
    """
    Checks if the letters of a given string can be rearranged so that
    two characters that are adjacent to each other are different.
    """
    string_length = len(S)

    if not S:
        return True

    char_counts = collections.Counter(S)
    max_frequency = max(char_counts.values())

    # A valid rearrangement is possible if and only if the frequency of the
    # most common character is not more than half the string length, rounded up.
    # This can be expressed as: max_frequency <= ceil(n / 2).
    # In integer arithmetic, this is equivalent to: max_frequency <= (n + 1) // 2.
    
    # If this condition is met, a valid string can be constructed.
    # If it's not met, the most frequent character will inevitably have
    # at least one pair of adjacent instances, by the pigeonhole principle.
    
    return max_frequency <= (string_length + 1) // 2
```