function max (x,y : longint) : longint;
begin
if x>y then max:=x else max:=y;
end;
var k : longint; s : string;
begin
readln(s);
while (pos('.',s)<>0)or(pos('!',s)<>0)or(pos('?',s)<>0) do
begin
k:=k+1;
Delete(s,max(max(pos('.',s),pos('!',s)),pos('?',s)),1);
end;
writeln(k);
end.