比赛 20130725暑期B班1测 评测结果 AAAAAAAAAA
题目名称 单词缩写 最终得分 100
用户昵称 bingo 运行时间 0.003 s
代码语言 Pascal 内存使用 0.17 MiB
提交时间 2012-07-18 11:26:55
显示代码纯文本
const
 d:string=('abcdefghijklmnopqrstuvwxyz');
var
 n,i,j,k,st,et:integer;
 s,p:string;
 f,g:text;
begin
 assign(f,'abbreviation.in');
 assign(g,'abbreviation.out');
 reset(f);
 rewrite(g);
 readln(f,n);
 for i:=1 to n do
  begin
   j:=0;
   readln(f,s);
   repeat
    j:=j+1;
     if s[j]<>' ' then begin
                        st:=j;
                        repeat
                         j:=j+1;
                        until (j=length(s)+1)or(s[j]=' ');
                        et:=j-1;
                        p:=copy(s,st,et-st+1);
                        if (length(p)>=3)and
                           (p<>'and')and(p<>'anD')and(p<>'aNd')and(p<>'aND')and
                           (p<>'And')and(p<>'AnD')and(p<>'ANd')and(p<>'AND')and
                           (p<>'for')and(p<>'foR')and(p<>'fOr')and(p<>'fOR')and
                           (p<>'For')and(p<>'FoR')and(p<>'FOr')and(p<>'FOR')and
                           (p<>'the')and(p<>'thE')and(p<>'tHe')and(p<>'tHE')and
                           (p<>'The')and(p<>'ThE')and(p<>'THe')and(p<>'THE')
                        then if pos(s[st],d)<>0 then write(g,chr(ord(s[st])-32))
                                                else write(g,s[st]);
                       end;
    until j=length(s)+1;
   writeln(g);
  end;
  close(f);
  close(g);
end.