Python 2, 74 64 56 5555 53 bytes
x=inputdef f(x)
:a=ord(max(x))-54
a+=7*54;a+=7*(a<8)
print(;print int(x,a),a)
Call the function (i.e. f("HELLOWORLD")
) and outputs to stdout (809608041709942 33
)
This is case-sensitive, requiring upper case letters, and crashes for invalid input (e.g. "$^$%!(&£%)()
)
This code gets the max
letter in the string (z>x>y>...>b>a>9>8>...>2>1>0) and gets the largest base needed to represent it.
Change the 54
into a 76
to make it work for lowercase (but no longer upper case).