7
The Challenge
Input: alphanumeric string. You can assume that the string will only contain the characters [0-9A-Z]. This can come from a parameter, command line, or STDIN. Digits are always before letters in terms of the base. Think like an extended version of HEX.
Output X,Y
Such that Y
is the minimum base required to parse the string and X
is the decimal value of the input string in that base.
Examples
Input: "1"
Output: 1,2
Input: "HELLOWORLD"
Output: 809608041709942,33
Scoring: This is a golf, so shortest code in bytes wins.
1
Borderline dupe of Base X to base Y conversion. (And probably one or more of the other 370 existing questions which talk about bases).
– Peter Taylor – 2015-04-17T19:11:25.973@PeterTaylor I would argue that this is different from the Base X to Y conversion, primarily because you are not supplied with the start base. It is an additional calculation the program must make. As for the search link, that is why this is specifically tagged as base-conversion. – tfitzger – 2015-04-17T20:03:08.633
I said it was borderline dupe, not identical (although it does only take 5 or 6 chars in golfing languages to extract the base, so it's not exactly a non-trivial difference), and held back from casting a supervote to see whether others agreed. Since no-one else has cast a close vote yet, I'll post an answer. – Peter Taylor – 2015-04-17T22:00:53.240
Related: http://codegolf.stackexchange.com/q/40416/21348 (should it be tagged
– edc65 – 2015-04-18T09:31:06.013base-conversion
?)