fork(1) download
  1. program main;
  2. const alpha=['А'..'Я', 'а'..'п', 'р'..'я',
  3. '.', ',', '-', ':', ';', '?',
  4. '!', '"'];
  5. type T=array[1..100] of string;
  6. type A=set of char;
  7. var i, j, k: integer;
  8. found, s, temp: string;
  9. n: integer; {Количество прочитанных слов}
  10. words: T; {Массив слов}
  11. first: A; {Множество букв первого слова}
  12. flag: boolean;
  13.  
  14.  
  15. procedure GetWords(s: string; var a: T; var n: Integer);
  16. var _word: String;
  17. i: Integer;
  18. begin
  19. i:=1;
  20. n:=0;
  21. s:=s+ ' ';
  22. while i<length(s) do
  23. if s[i] in alpha then begin
  24. _word:='';
  25. while (s[i] in alpha) and (i<length(s)) do begin
  26. _word:=_word+s[i];
  27. inc(i);
  28. end;
  29. if _word <> ' ' then begin
  30. inc(n);
  31. a[n]:=_word;
  32. end;
  33. end
  34. else inc(i);
  35. a[n]:=a[n]+s[i];
  36. end;
  37.  
  38. function up(s: string): string;
  39. var i: Integer;
  40. s1: string;
  41. begin
  42. s1:='';
  43. for i:=1 to length(s) do
  44. case s[i] of
  45. 'А'..'Я' : s1:=s1+s[i];
  46. 'а'..'п': s1:=s1+chr(ord('А')+ord(s[i])-ord('а'));
  47. 'р'..'я': s1:=s1+chr(ord('П')+ord(s[i])-ord('п'));
  48. end;
  49. up:=s1;
  50. end;
  51.  
  52. begin
  53. assign(input, 'input.txt');
  54. reset(input);
  55. assign(output, 'output.txt');
  56. rewrite(output);
  57.  
  58. flag:=false;
  59. while not eof(input) do begin
  60. readln(input, s);
  61. GetWords(s, words, n);
  62. if not flag then
  63. for i:=1 to length(words[1]) do
  64. include(first, words[1][i]);
  65. flag:=true;
  66.  
  67. for i:=1 to n do begin
  68. j:=1;
  69. k:=0; {Количество букв в текущем слове, содержащихся также в первом слове}
  70. temp:='(';
  71. for j:=1 to length(words[i]) do begin
  72. if words[i][j] in first then begin
  73. temp:=temp+words[i][j];
  74. inc(k);
  75. end;
  76. end;
  77. if k>=3 then begin
  78. temp:=temp+')';
  79. write(output, up(words[i]), ' ', temp, ' ');
  80. end
  81. else
  82. write(output,words[i], ' ');
  83. end;
  84. end;
  85. close(input);
  86. close(output);
  87. end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Free Pascal Compiler version 2.2.0 [2009/11/16] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling prog.pas
prog.pas(2,24) Error: Ordinal expression expected
prog.pas(23,9) Error: Incompatible types: got "Char" expected "Byte"
prog.pas(25,15) Error: Incompatible types: got "Char" expected "Byte"
prog.pas(45,18) Error: Constant and CASE types do not match
prog.pas(46,17) Error: Constant and CASE types do not match
prog.pas(46,17) Error: duplicate case label
prog.pas(46,30) Error: Ordinal expression expected
prog.pas(46,50) Error: Ordinal expression expected
prog.pas(47,17) Error: Constant and CASE types do not match
prog.pas(47,17) Error: duplicate case label
prog.pas(47,30) Error: Ordinal expression expected
prog.pas(47,50) Error: Ordinal expression expected
prog.pas(64,9) Warning: Variable "first" does not seem to be initialized
prog.pas(87,4) Fatal: There were 12 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
stdout
Standard output is empty