fork download
  1. program scopa;
  2.  
  3. var
  4. line: ansistring;
  5. i, number: longint;
  6. suit: char;
  7.  
  8. procedure readcard(var s: ansistring; var number: longint; var suit: char);
  9. begin
  10. if (s[1] = '1') and (s[2] = '0') then
  11. begin
  12. number := 10;
  13. suit := s[3];
  14. s := copy(s, 5, length(s));
  15. end else begin
  16. number := ord(s[1]) - ord('0');
  17. suit := s[2];
  18. s := copy(s, 4, length(s));
  19. end;
  20. end;
  21.  
  22.  
  23.  
  24. begin
  25. {
  26.   uncomment the following lines if you want to read/write from files
  27.   assign(input, 'input.txt'); reset(input);
  28.   assign(output, 'output.txt'); rewrite(output);
  29. }
  30.  
  31. readln(line);
  32. for i:=1 to 3 do
  33. begin
  34. { card in hand }
  35. readcard(line, number, suit);
  36. writeln (line);
  37. { use number and suit }
  38. end;
  39.  
  40. readln(line);
  41. for i:=1 to 4 do
  42. begin
  43. { card on table }
  44. readcard(line, number, suit);
  45. writeln(line);
  46. { use number and suit }
  47. end;
  48.  
  49. { insert your code here }
  50.  
  51. writeln(42); { change 42 with actual answer }
  52. end.
  53.  
Success #stdin #stdout 0.01s 5284KB
stdin
5G 7S 8S
2G 3C 1S 2C

stdout
7S 8S
8S

3C 1S 2C
1S 2C
2C

42