// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
leaq 0x10(%rsp), %rbx
andl $0x0, (%rbx)
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
movq %rbx, 0x8(%rax)
movq %rbx, 0x10(%rax)
andq $0x0, 0x18(%rax)
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x2ce0(%rip), %r12      # 0x3fe0
leaq 0x38(%rsp), %r15
leaq 0xcfc(%rip), %r14       # 0x2008
movq %r12, %rdi
movq %r15, %rsi
callq 0x1040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x13d0
movq %r15, %rdi
movq %r14, %rsi
callq 0x1695
testb %al, %al
je 0x130c
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x16b8
movq %rax, %rbp
movq %r15, %rsi
movq %r12, %r15
movq %r14, %r12
movq %rax, %r13
addq $0x20, %r13
movq %r13, %rdi
callq 0x1120
leaq 0x18(%rsp), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x138b
leaq 0x20(%r14), %rsi
movq %r13, %rdi
callq 0x1606
xorb $0x1, %al
movzbl %al, %eax
leaq (%r14,%rax,8), %rax
addq $0x10, %rax
movq %r14, %rbx
jmp 0x1365
leaq 0x10(%rsp), %rax
cmpq %rbx, %rax
movq %r12, %r14
je 0x13a6
leaq 0x20(%rbx), %rsi
movq %r13, %rdi
callq 0x1606
jmp 0x13a8
movb $0x1, %al
movq %r15, %r12
movzbl %al, %edi
movq %rbp, %rsi
movq %rbx, %rdx
leaq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x1030
incq 0x30(%rsp)
leaq 0x38(%rsp), %r15
jmp 0x130c
movq 0x20(%rsp), %r15
pushq $0x10
popq %r14
cmpq %rbx, %r15
je 0x151d
addq $0x20, %r15
movq %rbx, %r13
leaq 0x18(%rsp), %r12
movq (%r12), %r12
testq %r12, %r12
je 0x1434
leaq 0x20(%r12), %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1606
testb %al, %al
je 0x1413
pushq $0x18
popq %rcx
movq %r13, %rdx
jmp 0x142c
movq %r15, %rdi
movq %rbp, %rsi
callq 0x1606
movq %r14, %rcx
movq %r12, %rdx
testb %al, %al
je 0x14c0
addq %rcx, %r12
movq %rdx, %r13
jmp 0x13ee
movq %r13, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x16e7
movq %rax, %r12
movq %r15, %rdi
leaq 0xbb5(%rip), %rsi       # 0x2004
xorl %edx, %edx
callq 0x1180
cmpq $-0x1, %rax
je 0x1479
cmpq $0x2, %r12
jb 0x1470
movq %r12, %rdi
shrq %rdi
movq %r15, %rsi
callq 0x158e
testb $0x1, %r12b
je 0x1484
xorl %r12d, %r12d
movq %r12, %rdi
movq %r15, %rsi
callq 0x158e
movq %rbx, %r12
leaq 0x18(%rsp), %rax
movq (%rax), %r13
testq %r13, %r13
je 0x14b8
leaq 0x20(%r13), %rsi
movq %r15, %rdi
callq 0x1606
testb %al, %al
cmovneq %r13, %r12
xorb $0x1, %al
movzbl %al, %eax
leaq 0x10(,%rax,8), %rax
addq %r13, %rax
jmp 0x148c
movq %r12, %r15
jmp 0x13d9
leaq 0x10(%r12), %rax
movq 0x18(%r12), %rbp
movq (%rax), %rbx
testq %rbx, %rbx
je 0x14f1
leaq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0x1606
testb %al, %al
cmoveq %rbx, %r12
movzbl %al, %eax
leaq (%rbx,%rax,8), %rax
addq $0x10, %rax
jmp 0x14ca
leaq 0x10(%rsp), %rbx
testq %rbp, %rbp
je 0x1437
leaq 0x20(%rbp), %rsi
movq %r15, %rdi
callq 0x1606
testb %al, %al
cmovneq %rbp, %r13
xorb $0x1, %al
movzbl %al, %eax
movq 0x10(%rbp,%rax,8), %rbp
jmp 0x14f6
leaq 0x38(%rsp), %rdi
callq 0x1090
leaq 0x8(%rsp), %rdi
callq 0x15c4
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x1080
pushq $0x40
popq %rsi
movq %rbp, %rdi
callq 0x10f0
callq 0x1140
movq %rax, %rbx
callq 0x1160
jmp 0x1571
movq %rax, %rdi
callq 0x169f
jmp 0x156e
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x1090
leaq 0x8(%rsp), %rdi
callq 0x15c4
movq %rbx, %rdi
callq 0x1170
nop