Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Cabinets
Time Limit: 1000MSMemory Limit: 10000K
Total Submissions: 360Accepted: 70

Description

Well-Built Cabinet Distributors, Inc. recently received an electronic catalog of cabinets from their leading manufacturer, Woodcraft. Unfortunately, the format of the data is not consistent with that expected by Well-Built's inventory software. For this problem, you will construct a program that reformats the Woodcraft catalog for use by the inventory software.

Input

The input will contain multiple cases,each of them as described below.There is a blank line between two consecutive cases.
Input will be formatted as from a comma-delimited ASCII file. Your program must read all input from the standard input file. Each line in the input has a maximum length of 64 characters and contains the following fields:
Field         Length   Explanation

----------------------------------------------------------------------------
Style Code 1-3 Code specifying the cabinet's style.
Style Name 0-15 Name for cabinet style.
Description 1-15 Code describing type of cabinet.
Extension 0-25 Additional information about cabinet.
Unit Price 0-6 Manufacturer's suggested retail price (dollars x 100).

The records are presented in ascending order by Style Code. You may assume that all fields will be consistent with the lengths given, and that all fields will contain appropriate characters.

Output

Output will consist of a reformatted catalog. The reformatted catalog file will be a comma-delimited ASCII file. The first record in the file must be the following:
Item Id,Item Desc,Item Price
Each remaining record in the file will have a maximum length of 50 characters and contain the following fields:
Field         Length   Explanation

----------------------------------------------------------------------------
Item Id 4-13 Unique identification code for inventory database.
Item Desc 1-30 Inventory description of cabinet.
Item Price 4-7 Manufacturer's suggested retail price.

The Item Id is formed by concatenating the Style Code and the Description. If the Style Code is less than three characters long, it must be left-filled with zeros to three characters. If the Item Id exceeds 13 characters, then the record is rejected.

The Item Desc is formed by concatenating the Style Name, a hyphen, and the Extension. If the Style Name is missing, use the Style Name from the first record of the corresponding Style Code group. If this first record has no Style Name either, then reject the record. If the Extension is not present, then Item Desc is the same as Style Name (no hyphen). If Item Desc exceeds 30 characters, then it must be truncated on the right.

The Item Price is formed by formatting the Unit Price as dollars and cents. If Unit Price is not present, then Item Price = 0.00.

Sample Input

23,CHAMPAGNE,BASE36,3" RECESSED TOE KICK,8900 
23,,BASE54,,11000
25,LAUREL,CNR24LT,,15000 
107,COLONIAL,BASE54WSIDEJAM
202,SAGEBRUSH,OVRHD54P,USE WITH HDWARE KIT #3207 
221,ALVEA MODERN,BASE36
221,ALVEA MODERN,OVRHD54WCAP

Sample Output

Item Id,Item Desc,Item Price
023BASE36,CHAMPAGNE-3" RECESSED TOE KICK,89.00 
023BASE54,CHAMPAGNE,110.00 
025CNR24LT,LAUREL,150.00
202OVRHD54P,SAGEBRUSH-USE WITH HDWARE KIT ,0.00 
221BASE36,ALVEA MODERN,0.00

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator