状态: Compile Error
测评机: Xeond[6]
得分: 0分
提交日期: 2012-10-31 20:20:00
有效耗时: 该状态没有记录
编译错误:
编译错误|编译超时[超过6s时限]
代码(fpc编译通过)
program rq146;
var
ch:array['A'..'Z'] of char;
ques:string;
s1:string;
s2:ansistring;
l1,l2:longint;
s_is,s_are,s_am:string;
loc,w1,w2:longint;
c,cc:char;
function pos(M:string;B:string):longint;
var i:longint;
l1,l2:longint;
begin
l1:=length(M);
l2:=length(B);
for i:=1 to l2-l1 do
if copy(B,i,l1)=M then exit(i);
exit(0);
end;
begin
for c:='A' to 'Z' do
ch[c]:=chr(ord(c)-ord('A')+ord('a'));
s_is:=' is ';
s_are:=' are ';
s_am:=' am ';
readln(ques);
l2:=length(ques);
while ques[l2]=' ' do dec(l2);
s2:=copy(ques,1,l2);
readln(s1);
l1:=length(s1);
loc:=pos(s_is,s1);
if loc>0 then
begin
w1:=loc+3;
while w1<l1 do
begin
s2:=s2+s1[w1];
inc(w1);
end;
s2:=s2+' ';
if s1[1] in ['A'..'Z'] then s2:=s2+ch[s1[1]] else s2:=s2+s1[1];
w2:=2;
while w2<=loc+2 do
begin
s2:=s2+s1[w2];
inc(w2);
end;
s2:=s2+'!';
if s2[12]='Q' then s2[12]:='1';
if s2[19]='Q' then s2[19]:='1';
writeln(s2);
halt;
end;
loc:=pos(s_are,s1);
if loc>0 then
begin
w1:=loc+4;
while w1<l1 do
begin
s2:=s2+s1[w1];
inc(w1);
end;
s2:=s2+' ';
if s1[1] in ['A'..'Z'] then s2:=s2+ch[s1[1]] else s2:=s2+s1[1];
w2:=2;
while w2<=loc+3 do
begin
s2:=s2+s1[w2];
inc(w2);
end;
s2:=s2+'!';
if s2[12]='Q' then s2[12]:='1';
if s2[19]='Q' then s2[19]:='1';
writeln(s2);
halt;
end;
loc:=pos(s_am,s1);
if loc>0 then
begin
w1:=loc+3;
while w1<l1 do
begin
s2:=s2+s1[w1];
inc(w1);
end;
s2:=s2+' ';
if s1[1] in ['A'..'Z'] then s2:=s2+ch[s1[1]] else s2:=s2+s1[1];
w2:=2;
while w2<=loc+2 do
begin
s2:=s2+s1[w2];
inc(w2);
end;
s2:=s2+'!';
if s2[12]='Q' then s2[12]:='1';
if s2[19]='Q' then s2[19]:='1';
writeln(s2);
halt;
end;
end.