比赛 20130725暑期B班1测 评测结果 AAWWWWWWWW
题目名称 单词缩写 最终得分 20
用户昵称 antenna 运行时间 0.007 s
代码语言 Pascal 内存使用 0.17 MiB
提交时间 2012-07-18 09:56:06
显示代码纯文本
var
s,word:string;
t,i,j:longint;

function delete_s(sub:string):boolean;
var a:longint;
begin
a:=pos(sub,s);
if a<>0 then begin delete(s,a,length(sub));exit(true);end;
exit(false);
end;

function isalpha(a:char):boolean;
begin
if ( (ord(a)<=90) and (ord(a)>=65) ) or ( (ord(a)>=97) and (ord(a)<=122) )
then exit(true) else exit(false);
end;

function upper(a:char):char;
begin
if (ord(a)<=122) and (ord(a)>=97) then exit(chr(ord(a)-32)) else exit(a);
end;





begin
assign(input,'abbreviation.in');reset(input);
assign(output,'abbreviation.out');rewrite(output);

readln(t);
for i:=1 to t do
begin
readln(s);
while delete_s('for ') do ;
while delete_s(' for') do ;
while delete_s('and ') do ;
while delete_s(' and') do ;
while delete_s('the ') do ;
while delete_s(' the') do ;
while delete_s('For ') do ;
while delete_s(' For') do ;
while delete_s('And ') do ;
while delete_s(' And') do ;
while delete_s('The ') do ;
while delete_s(' The') do ;
while delete_s('FOR ') do ;
while delete_s(' FOR') do ;
while delete_s('AND ') do ;
while delete_s(' AND') do ;
while delete_s('THE ') do ;
while delete_s(' THE') do ;
j:=0;
word:='';
s:=s+',';
while j<length(s) do
begin

inc(j);
if isalpha(s[j]) then
begin
word:=word+s[j];
end
else
begin
if length(word)>=3 then write(upper(word[1]));
word:='';
end;
end;

writeln;

end;



close(input);
close(output);
end.