fork download
  1. program paradox;
  2. var n, i, R, count:integer;
  3. S: array[1..325] of string;
  4. A,B,SY: array [1..325] of char;
  5. lettere : array[1..26] of integer;
  6. risposta: string;
  7. begin
  8. readln(N);
  9. for i:=1 to N do readln(S[i]);
  10. for i:=1 to N do begin A[i]:=S[i][1]; SY[i]:=S[i][3]; B[i]:=S[i][5];end;
  11. for i:=1 to 26 do lettere[i]:=0;
  12. for i:=1 to N do begin if SY[i]='<' then lettere[ord(A[i])-96]:=lettere[ord(A[i])-96]+1
  13. else lettere[ord(B[i])-96]:=lettere[ord(B[i])-96]+1; end;
  14. risposta:=':('; count:=0;
  15. for i:=1 to 26 do begin if lettere[i]=0 then count:=count+1; end;
  16. if 26-count=N then risposta:=':('
  17. else begin for i:=1 to 26 do if ((lettere[i]=2) or (lettere[i]=1)) then R:=R+1; if R=N-1 then risposta:=':)';end;
  18. writeln(risposta);
  19. end.
Success #stdin #stdout 0s 5284KB
stdin
3
a > b
c < b
a < c
stdout
:(