Post History
#14: Post edited
Presumptuous base conversion
- Presumptuous base conversion [FINALIZED]
- Take an input string representing a number and convert it to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- # Now posted: [Presumptuous base conversion](https://codegolf.codidact.com/posts/287035)
- ---
- Take an input string representing a number and convert it to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#13: Post edited
Convert an input string representing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Take an input string representing a number and convert it to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#12: Post edited
Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string representing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#11: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- If the highest digit in the input is N, then the input is to be treated as being in base N+1- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is represented by N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#10: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- Apart from inputs assumed to be in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#9: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- If the highest digit in the input is N, then assume the input is in base N+1- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input- - Apart from inputs assumed to be in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then the input is to be treated as being in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then the input is to be treated as being in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#8: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes make no difference to the output. Both "11" and "000011" lead to output "3"
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#7: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
## ExampleIf the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Examples
- - If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- - If the input is **000** then the highest digit is **0** so the input is in base 1 (unary). The output is 3, which is simply the length of the unary input
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#6: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - For this challenge, the letters A to F count as "digits". So if the highest digit in the input is B, which represents 11, then the input is in base 12
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#5: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **453** then the highest digit is **5**, so the input is in base 6. The output is 177, calculated as **4**[]()\*6\*6 + **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- 453 : 177
- ```
#4: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
20 : 3- 22 : 8
- 65 : 47
- 99 : 99
AA : 121- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 6
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 120
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
#3: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
## Specification1. The input consists of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 151. The answerer may choose to take lower case input instead1. If the highest digit in the input is N, then the input is in base N+11. In particular, if the highest digit is 0, then the input is in base 1 (unary) and the output is the number of digits in the input1. The input will sometimes have leading zeroes1. Apart from inputs in base 1 (unary), leading zeroes are ignored- ## Example
- If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 3
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 121
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Input
- - The input consists only of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- - The answerer may choose to take lower case input instead
- - The input will always contain at least one character (it will never be empty)
- - The input will sometimes have one or more leading zeroes
- ## Output
- - If the highest digit in the input is N, then assume the input is in base N+1
- - In particular, if the highest digit in the input is 0, then assume the input is in base 1 (unary), so the output is the number of digits in the input
- - Apart from inputs assumed to be in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 3
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 121
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
#2: Post edited
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Specification
- The input consists of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15- The answerer may choose to take lower case input instead- If the highest digit in the input is N, then the input is in base N+1- In particular, if the highest digit is 0, then the input is in base 1 (unary) and the output is the number of digits in the input- The input will sometimes have leading zeroes- Apart from inputs in base 1 (unary), leading zeroes are ignored- ## Example
- If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 3
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 121
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
- Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid.
- ## Specification
- 1. The input consists of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15
- 1. The answerer may choose to take lower case input instead
- 1. If the highest digit in the input is N, then the input is in base N+1
- 1. In particular, if the highest digit is 0, then the input is in base 1 (unary) and the output is the number of digits in the input
- 1. The input will sometimes have leading zeroes
- 1. Apart from inputs in base 1 (unary), leading zeroes are ignored
- ## Example
- If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3**
- ## Test cases
- Test cases are in the form `input : output`
- ```text
- 0 : 1
- 1 : 1
- 9 : 9
- A : 10
- E : 14
- F : 15
- 00 : 2
- 01 : 1
- 10 : 2
- 11 : 3
- 02 : 2
- 20 : 3
- 22 : 8
- 65 : 47
- 99 : 99
- AA : 121
- B8 : 140
- 000 : 3
- 00F : 15
- 0D0 : 182
- C00 : 2028
- 123 : 27
- ABC : 1845
- 777 : 511
- ```
#1: Initial revision
Presumptuous base conversion
Convert an input string containing a number to decimal (base 10). However, the base of the input is **not** specified. Assume the input is in the smallest base for which its digits are valid. ## Specification - The input consists of characters from 0123456789ABCDEF where A to F represent the decimal numbers 10 to 15 - The answerer may choose to take lower case input instead - If the highest digit in the input is N, then the input is in base N+1 - In particular, if the highest digit is 0, then the input is in base 1 (unary) and the output is the number of digits in the input - The input will sometimes have leading zeroes - Apart from inputs in base 1 (unary), leading zeroes are ignored ## Example If the input is **53** then the highest digit is **5**, so the input is in base 6. The output is 33, calculated as **5***6 + **3** ## Test cases Test cases are in the form `input : output` ```text 0 : 1 1 : 1 9 : 9 A : 10 E : 14 F : 15 00 : 2 01 : 1 10 : 2 11 : 3 02 : 2 20 : 3 22 : 8 65 : 47 99 : 99 AA : 121 B8 : 140 000 : 3 00F : 15 0D0 : 182 C00 : 2028 123 : 27 ABC : 1845 777 : 511 ```