Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program First;
- const
- MAXIN = 100000;
- var
- s, s1:string;
- i, in1, k: integer;
- f, t:text;
- a: array [0..MAXIN] of integer;
- begin
- assign(f,'input.txt');
- reset(f);
- assign(t,'output.txt');
- rewrite(t);
- readln(f, s);
- readln(f, s1);
- k := 0;
- i := 1;
- in1 := 1;
- while(i <= length(s)) do
- begin
- if not(upcase(s[i]) in ['A'..'Z']) then
- begin
- a[in1] := k;
- delete(s, in1, k);
- if (k <> 0) then
- begin
- i := in1 + 1;
- k := 0;
- insert('?', s, in1);
- end;
- end
- else
- if (k = 0) and (upcase(s[i]) in ['A'..'Z']) then
- begin
- in1 := i;
- k := 1;
- end
- else
- if (upcase(s[i]) in ['A'..'Z']) then
- inc(k);
- i := i + 1;
- end;
- if (k <> 0) then
- begin
- a[in1] := length(copy(s, in1, k));
- delete(s, in1, k);
- k := 0;
- insert('?', s, in1);
- end;
- k := 0;
- for i := 1 to length(s) do
- if (s[i] <> s1[i]) then
- begin
- writeln(t, k);
- close(f);
- close(t);
- exit;
- end
- else
- if (s[i] <> '?') then
- inc(k)
- else
- inc(k, a[i]);
- writeln(t, k);
- close(f);
- close(t);
- end.
Advertisement
Add Comment
Please, Sign In to add comment