1 条题解
-
0
Pascal :
program calfflac; var s:array[1..20000]of char; lch,max,i,first,last:integer; procedure check(odd:byte); var lth,l,r,b,e:integer; begin l:=i; r:=i+odd; if odd=1 then begin while (r<=lch)and(not(s[r] in ['a'..'z','A'..'Z'])) do inc(r); if (r>lch)or(upcase(s[r])<>upcase(s[l])) then exit; lth:=0; end else lth:=-1; repeat b:=l; e:=r; inc(lth,2); dec(l); inc(r); while (1<=l) and (not (s[l] in ['a'..'z','A'..'Z'])) do dec(l); while (r<=lch) and (not (s[r] in ['a'..'z','A'..'Z'])) do inc(r) until (l<1) or (r>lch) or (upcase(s[l])<>upcase(s[r])); if lth>max then begin first:=b; last:=e; max:=lth; end; end; begin lch:=0; while not eof do begin inc(lch); read(s[lch]); end; max:=1; first:=1; last:=1; for i:=1 to lch do begin if not(s[i] in ['a'..'z','A'..'Z']) then continue; check(0); check(1); end; writeln(max); for i:=first to last do write(s[i]); writeln; end.
- 1
信息
- ID
- 3256
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者