Count the Lone Ones

Published by Deep Xavier in

Create a function which counts the cardinality of lone 1s in a given number. Lone means the number doesn't appear more than once in a row.

Examples

countLoneOnes(101) ➞ 2

countLoneOnes(1191) ➞ 1

countLoneOnes(1111) ➞ 0

countLoneOnes(462) ➞ 0

Notes

Tests will only include positive whole numbers.

Watch a quick demo on how Edabit works.