[Buổi 20][Chuỗi][WS] Bài 1: Data Normalizer


LÀM BÀI

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

Author:
Problem types
Allowed languages
C++

Data Normalizer

Bối cảnh

Một record có format name|code. Cả hai field có thể chứa whitespace thừa; tên có case lộn xộn.

Hãy tạo một normalizer nhỏ để xuất dữ liệu thống nhất.

Yêu cầu

  1. Đọc cả dòng.
  2. Tìm delimiter |; nếu không có hoặc một field rỗng sau trim/normalize, in INVALID.
  3. Chuẩn hóa name về Title Case.
  4. Chuẩn hóa code: bỏ whitespace đầu/cuối và chuyển thành uppercase.
  5. In normalizedName|NORMALIZEDCODE.

Input

Một dòng raw record.

Output

INVALID hoặc record đã chuẩn hóa.

Ràng buộc

1 ≤ |line| ≤ 500; dữ liệu ASCII cơ bản.

Ví dụ 1

Input

nGUYEN   van an  |  k62-001

Output

Nguyen Van An|K62-001

Giải thích

Name thành Nguyen Van An; code thành K62-001.

Ví dụ 2

Input

Le thi B|tnut42

Output

Le Thi B|TNUT42

Giải thích

Le thi BTNUT42 là dữ liệu chuẩn hóa.

Thông tin học tập

  • Module: M06
  • Buổi: B20
  • Loại bài: WORKSHOP
  • Độ khó: Medium
  • Concepts: getline, string normalization, find, substr, cctype, validation
  • Giới hạn kiến thức: B01-B20
  • Time limit: 2 second(s)
  • Memory limit: 256 MB
  • Point: 100

Comments

There are no comments at the moment.

Zalo