fork download
  1. program consonants;
  2.  
  3. function consonant_counter(s:string):string;
  4. const letters = ['A'..'Z'];
  5. const vowels = ['A','E','I','O','U'];
  6. var counter:array['A'..'Z'] of integer;
  7. i, len:integer;
  8. c:char;
  9. begin
  10. s:=UpCase(s);
  11. len:=Length(s);
  12. for c:='A' to 'Z' do begin
  13. counter[c]:=0;
  14. end;
  15.  
  16. for i:=1 to len do begin
  17. if (s[i] in letters) and not (s[i] in vowels) then begin
  18. inc(counter[s[i]]);
  19. end;
  20. end;
  21.  
  22. consonant_counter:='';
  23. for c:='A' to 'Z' do begin
  24. if counter[c] = 1 then begin
  25. consonant_counter := consonant_counter + c;
  26. end;
  27. end;
  28. end;
  29.  
  30. var s;
  31.  
  32. begin
  33. readln(s);
  34. writeln(consonant_counter(s));
  35. end.
Compilation error #stdin compilation error #stdout 0s 340KB
stdin
Hello, world!
compilation info
Free Pascal Compiler version 3.0.0+dfsg-10 [2016/12/12] for x86_64
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling prog.pas
prog.pas(30,6) Fatal: Syntax error, ":" expected but ";" found
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
stdout
Standard output is empty