Count the Lone Ones

Published by Deep Xavier in

Create a function which counts how many lone 1s appear in a given number. Lone means the number doesn't appear twice or more in a row.

Examples

countLoneOnes(101) ➞ 2

countLoneOnes(1191) ➞ 1

countLoneOnes(1111) ➞ 0

countLoneOnes(462) ➞ 0

Notes

Tests will include positive whole numbers only.

Watch a quick demo on how Edabit works.