记录编号 73151 评测结果 WWWWWWWWWW
题目名称 [暑假培训2012] 单词缩写 最终得分 0
用户昵称 Gravatar翟佳麒 是否通过 未通过
代码语言 Pascal 运行时间 0.004 s
提交时间 2013-10-20 14:27:31 内存使用 0.41 MiB
显示代码纯文本
program p932;
var
t,i,j,n:integer;
s:array[0..999] of string;
k:char;
begin
assign(input,'abbreviation.in');
reset(input);
assign(output,'abbreviation.out');
rewrite(output);
readln(t);
for i:=1 to t do
readln(s[i]);
for i:=1 to t do
begin
if (ord(s[i][1])>=65)and(ord(s[i][1])<=90) then write(s[i][1])
else write(chr(ord(s[i][1])-32));
for j:=2 to length(s[i]) do
begin
for k:='A' to 'Z' do
if (s[i][j]=k)and(s[i][j-1]=' ') then write(k);
end;
writeln;
end;
end.
{program P932;
const
q:array[1..3] of string=('and','for','the');
var
a:array[1..200] of string;
c:char;
i,j,k,l,m,n,t:longint;
w,sum,u:string;
function find(w:string):boolean;
begin
for k:=1 to length(w) do
w[k]:=lowercase(w[k]);
if (w='and')or(w='for')or(w='the') then
exit(true) else exit(false);
end;
begin
assign(input,'abbreviation.in');
reset(input);
assign(output,'abbreviation.out');
rewrite(output);
readln(t);
for j:=1 to t do
begin
  readln(w);
  w:=w+' ';
  for i:=1 to length(w) do
    if w[i]=' ' then
    begin
      if (length(u)>2)and(not(find(u))) then
      begin c:=upcase(u[1]); sum:=sum+c; end;
      u:='';
    end
    else u:=u+w[i];
  writeln(sum);
  sum:='';
  end;
  end.}