ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1732. Ministry of Truth

Whats wrong ADMINS?
Posted by George Skhirtladze 12 Apr 2010 18:56
program ministerstvo;
var a,n,i,b,j,k,p,l:longint;
    s,w,q,r:string;
begin
readln(s);
readln(w);
n:=length(s);
k:=length(w);
i:=1;
j:=1;
l:=1;
p:=1;
while i<n do begin
if s[i]<>w[j] then begin
while s[p]<>w[l] do begin
if s[p]=' ' then
s[p]:=' ' else
s[p]:='_';
p:=p+1;
i:=i+1;
end;
end;
if s[i]=w[j] then begin
i:=i+1;
j:=j+1;
l:=j;
p:=i;
end;
end;
k:=0;
for i:=1 to n do
if s[i]<>'_' then k:=k+1;
if k<length(w) then
writeln('I HAVE FAILED!!!')
else
begin
if w[length(w)]=s[n] then
write(s[i])
else
begin
for i:=1 to n-1 do
write(s[i]);
end;
end;
end.