Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- s, ns:string;
- i, num10: integer;
- function bin2dec(s:string):integer;
- var
- nums: String;
- i:integer;
- begin
- nums:='01';
- result:=0;
- for i:=1 to length(S) do
- result:=result+(pos(S[i],nums)-1)*round(Exp((length(S)-i)*Ln(2)));
- end;
- begin
- read(s);
- s := LowerCase(s);
- ns := '';
- i := 1;
- while (i < length(s) - 1) do // цикл по всей строке
- begin
- if ((i + 2 <= length(s)) and (s[i] = 'o') and (s[i + 1] = 'n') and (s[i + 2] = 'e')) then
- begin
- ns := ns + '1';
- i := i + 3;
- end
- else
- if ((i + 3 <= length(s)) and (s[i] = 'z') and (s[i + 1] = 'e') and (s[i + 2] = 'r') and (s[i + 3] = 'o')) then
- begin
- ns := ns + '0';
- i := i + 4;
- end
- else
- inc(i);
- end;
- writeln(IntToStr(bin2dec(ns)));
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement