SHARE
TWEET

Untitled

a guest Jan 21st, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import std.stdio, std.algorithm, std.array, std.string, std.conv, std.format;
  2.  
  3. void main() {
  4.     char letter;
  5.     char[] deck;
  6.     char[] input;
  7.     int[] numbers;
  8.     size_t size = 0;
  9.     size_t size_negative = 0;
  10.     deck.length = 50;
  11.  
  12.     while(readln(input)){
  13.         try{
  14.             formattedRead(input, "%c:%(%d,%)\n",&letter, &numbers);
  15.         }
  16.         catch{
  17.             formattedRead(input, "%c:%(%d,%)",&letter, &numbers);
  18.         }
  19.         for(int i = 0; i < numbers.length; i++){
  20.             deck[numbers[i]+15] = letter;
  21.             if(numbers[i] > 0){
  22.                 size++;
  23.             }
  24.             else{
  25.                 size_negative++;
  26.             }
  27.         }
  28.     }
  29.     deck = deck[(16-size_negative)..(16+size)];
  30.     //deck.length = size_negative+size;
  31.     writeln(deck);
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top