The alphanumeric characters have ASCII-values:
0-9 -> 48-57
A-Z -> 65-90
a-z -> 97-122
Your challenge is to take an integer as input, and output how many characters can be made using consecutive digits of that number. The character codes may be overlapping. 666
should result in 2
, since you have 66
twice.
Test cases:
Input: 5698
Possible characters: '8' (56), 'E' (69), 'b' (98)
Output: 3
Input: 564693
Possible characters: '8' (56), 'E' (69)
Output: 2
Input: 530923864209124521
Possible characters: '5' (53), 'V' (86), '4' (52)
Output: 3
Input: 1111111
Possible characters: 'ooooo' (5*111)
Output: 5
Input: 5115643141276343
Possible characters: '3' (51), '8' (56), 'L' (76), 's' (115)
Output: 4
Input: 56789
Possible characters: '8' (56), 'C' (67), 'N' (78), 'Y' (89)
Output: 4
Input: 94
Possible characters: ''
Output: 0
Input: 1
Output: 0
Input and output formats are optional (yes, you may take the integer as a string).