You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
-module(words).
|
|
-export([count/1]).
|
|
|
|
count(S) -> count(S, true, 0).
|
|
|
|
count("", _, Total) -> Total;
|
|
count([$ |Tail], _, Total) -> count(Tail, true, Total);
|
|
count([_|Tail], false, Total) -> count(Tail, false, Total);
|
|
count([_|Tail], true, Total) -> count(Tail, false, Total + 1). |