python正则一行:

import re # python:3
print(max([int(i, base=16) if len(i) > 0 else 0 for i in re.split(r'[^0123456789ABCDEF]', input())]))