var s:string;i:integer;c:char;beginreadln(s);readln(c);while pos(c,s)<>0 do begininc(i);delete(s,pos(c,s),1);end;writeln(i);end.