[Buổi 21][Xử lý chuỗi][HW] Bài 1: Tần suất từ chuẩn hóa


LÀM BÀI

Points: 100
Time limit: 1.0s
Memory limit: 256M

Author:
Problem types
Allowed languages
C++

Tần suất từ chuẩn hóa

Bối cảnh

Một dòng gồm các từ chỉ chứa chữ cái. Không phân biệt hoa thường khi đếm.

Hãy in tần suất theo thứ tự từ điển tăng.

Yêu cầu

  1. Tách token theo whitespace.
  2. Lowercase.
  3. Đếm bằng map.
  4. In word count mỗi dòng.

Input

Một dòng.

Output

Mỗi dòng một word và count.

Ràng buộc

0 ≤ |line| ≤ 3000.

Ví dụ 1

Input

A a B b a

Output

a 3
b 2

Giải thích

a xuất hiện 3 lần, b xuất hiện 2 lần.

Ví dụ 2

Input

one two three

Output

one 1
three 1
two 1

Giải thích

Mỗi từ xuất hiện một lần và map in theo thứ tự từ điển.

Thông tin học tập

  • Module: M06
  • Buổi: B21
  • Loại bài: HOMEWORK
  • Độ khó: Medium
  • Concepts: stringstream, map, lowercase, frequency
  • Giới hạn kiến thức: B01-B21
  • Time limit: 1 second(s)
  • Memory limit: 256 MB
  • Point: 100

Comments

There are no comments at the moment.

Zalo