#! /usr/bin/python3
# Last edited on 2026-05-03 01:30:29 by stolfi

# Reads a file from stdin in UTF-8 possibly containing hanzi. Outputs to stdout a count 
# of occurrences of each character in it, excluding blanks and newlines.

import sys, os, re
from sys import stderr as err

def main():
  dic = dict()

  rd = sys.stdin
  rd.reconfigure(encoding='utf-8')
  
  wr = sys.stdout
  wr.reconfigure(encoding='utf-8')

  for line in rd:
    line = line.strip()
    line = re.sub(r"[ \001-\037]", "", line)
    for ch in line:
      if not ch in dic: dic[ch] = 0
      dic[ch] += 1
  
  for ch, count in dic.items():
    wr.write(f"{count:8d} {ch}\n")
    
  wr.flush()
  return
  # ----------------------------------------------------------------------

main()
       
