// File: kdungs[P]codecon/src/laundry.cc
// Function: main
int main() {
  const auto printItem = [](const std::size_t count, const std::string& item) {
    std::cout << count << '|' << item << '\n';
  };

  const auto alpha_compare =
      [](const std::string& lhs, const std::string& rhs) {
        return std::lexicographical_compare(
            std::begin(lhs), std::end(lhs), std::begin(rhs), std::end(rhs),
            [](char l, char r) { return std::tolower(l) < std::tolower(r); });
      };

  auto items =
      std::multiset<std::string, decltype(alpha_compare)>(alpha_compare);
  auto line = std::string{};
  while (getline(std::cin, line)) {
    if (line != "") {
      items.emplace(line);
    }
  }

  for (auto it = std::begin(items); it != std::end(items);
       it = items.upper_bound(*it)) {
    const auto& item = *it;
    auto count = items.count(item);

    if (item.find("sock") != std::string::npos) {  // we have a sock!
      if (count > 1) {
        printItem(count / 2, item);
      }
      if (count % 2 == 1) {  // one lonely sock left over
        printItem(0, item);
      }
    } else {
      printItem(count, item);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl $0x0, -0x4(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x36a0
movq -0xa8(%rbp), %rdx
leaq -0x38(%rbp), %rdi
leaq -0x6(%rbp), %rsi
callq 0x25b0
jmp 0x2348
leaq -0x39(%rbp), %rdi
callq 0x36c0
leaq -0x70(%rbp), %rdi
callq 0x2150
movq 0x4c7f(%rip), %rdi      # 0x6fe0
leaq -0x70(%rbp), %rsi
callq 0x2040
movq %rax, -0xb0(%rbp)
jmp 0x2373
movq -0xb0(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x2140
movb %al, -0xb1(%rbp)
jmp 0x2391
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x23a0
jmp 0x2429
leaq 0x1c61(%rip), %rsi      # 0x4008
leaq -0x70(%rbp), %rdi
callq 0x36e0
movb %al, -0xb2(%rbp)
jmp 0x23b8
movb -0xb2(%rbp), %al
testb $0x1, %al
jne 0x23c4
jmp 0x2424
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2630
movq %rax, -0xc0(%rbp)
jmp 0x23da
movq -0xc0(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x2424
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x36c0
jmp 0x259d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x20b0
leaq -0x38(%rbp), %rdi
callq 0x2790
jmp 0x259d
jmp 0x235a
leaq -0x38(%rbp), %rdi
callq 0x2670
movq %rax, -0xc8(%rbp)
jmp 0x243b
movq -0xc8(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x26a0
movq %rax, -0xd0(%rbp)
jmp 0x2458
movq -0xd0(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x3710
testb $0x1, %al
jne 0x247f
jmp 0x257f
leaq -0x80(%rbp), %rdi
callq 0x3740
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x26d0
movq %rax, -0xd8(%rbp)
jmp 0x24a8
movq -0xd8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x90(%rbp), %rdi
leaq 0x1b40(%rip), %rsi      # 0x4004
xorl %eax, %eax
movl %eax, %edx
callq 0x21c0
cmpq $-0x1, %rax
je 0x2526
cmpq $0x1, -0x98(%rbp)
jbe 0x24fb
movq -0x98(%rbp), %rsi
shrq %rsi
movq -0x90(%rbp), %rdx
leaq -0x5(%rbp), %rdi
callq 0x2700
jmp 0x24f9
jmp 0x24fb
movq -0x98(%rbp), %rax
andq $0x1, %rax
cmpq $0x1, %rax
jne 0x2524
movq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq -0x5(%rbp), %rdi
callq 0x2700
jmp 0x2522
jmp 0x2524
jmp 0x2541
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x5(%rbp), %rdi
callq 0x2700
jmp 0x253f
jmp 0x2541
jmp 0x2543
leaq -0x80(%rbp), %rdi
callq 0x3740
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x2750
movq %rax, -0xe0(%rbp)
jmp 0x2561
movq -0xe0(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x2446
leaq -0x70(%rbp), %rdi
callq 0x20b0
leaq -0x38(%rbp), %rdi
callq 0x2790
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x21a0
nopw %cs:(%rax,%rax)