uses crt;
var st:string;
i,d,dem:integer;
begin
clrscr;
readln(st);
d:=length(st);
while st[1]=' ' do
begin
delete(st,1,1);
d:=length(st);
end;
while st[d]=' ' do
begin
delete(st,d,1);
d:=length(st);
for i:=1 to d do
if (st[i]=' ' and st[i+1]=' ') then delete(st,i,1);
dem:=0;
for i:=1 to d do
if st[i]=' ' then dem:=dem+1;
writeln(dem+1);
readln;
end.