比赛 20130725暑期B班1测 评测结果 AAAAAAAAAA
题目名称 单词缩写 最终得分 100
用户昵称 如烟 运行时间 0.003 s
代码语言 Pascal 内存使用 0.41 MiB
提交时间 2012-07-18 11:27:00
显示代码纯文本
var
  i,j,n,p,k:integer;
  s:string;
  a:array[0..1000] of string;
begin
  assign(input,'abbreviation.in');
  reset(input);
  assign(output,'abbreviation.out');
  rewrite(output);
 readln(n);
 for i:=1 to n do
  begin
   readln(a[i]);
   p:=length(a[i]);
   j:=0;k:=0;
   repeat
   k:=k+1;
   j:=j+1;
   if (ord(a[i][j])<=122) and (ord(a[i][j])>=97) then
    a[i][j]:=chr(ord(a[i][j])-32);
   if (a[i][j]=' ')or(k=p)  then
    begin
    if a[i][j]=' ' then s:=copy(a[i],1,j-1);
    if k=p then s:=copy(a[i],1,j);
    delete(a[i],1,j);j:=0;
    if (length(s)>2) and (s<>'AND') and(s<>'FOR') and (s<>'THE') THEN
      write(s[1]);
    end;
   until k=p;
 writeln;
 end;
 close(input);
 close(output);
end.