parent
3700af5fdd
commit
a2b6b78630
@ -0,0 +1,9 @@
|
||||
-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).
|
Loading…
Reference in new issue