logo AlgoBeat OnlineJudge
登录 注册

#212664. [CCC 2025 Junior] Product Codes

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Score: 15.


A store has hired the Code Cleaning Crew to help it update all of its product codes.

The original product codes are sequences of letters, positive integers, and negative integers. For example, is a product code that contains two uppercase letters, three lowercase letters, one positive integer, and one negative integer.

The new product codes are made by removing all lowercase letters, keeping all uppercase letters in order, and adding all the integers to form one new integer which is placed at the end of the code. For example, the new product code for is .

Your job is to take a list of original product codes and determine the new product codes.

输入格式

The first line of input contains a positive integer, , representing the number of original product codes that need to be updated. The following lines each contain one original product code.

Each original product code contains at least one uppercase letter, at least one lowercase letter, and at least one integer. Also, a positive integer never immediately follows another integer. This means, for example, that is the integer instead of the integer followed by the integer .

输出格式

Output the new product codes, one per line.

样例

样例输入 1

1
AbC3c2Cd9

样例输出 1

ACC14

样例输入 2

3
Ahkiy-6ebvXCV1
393hhhUHkbs5gh6QpS-9-8
PL12N-2G1234Duytrty8-86tyaYySsDdEe

样例输出 2

AXCV-5
UHQS387
PLNGDYSDE1166

数据范围与提示

Explanation of Output for Sample Input 1

For the single original product code, the uppercase letters , , and are kept in order and the sum of the integers is .

Explanation of Output for Sample Input 2

For the first original product code, the uppercase letters , , , and are kept in order and the sum of the integers is .

For the second and third original product codes, their uppercase letters are also kept in order and the sums of the integers are and respectively.

The following table shows how the available marks are distributed:

Marks Description
2 All the integers are positive and single-digit
All the integers are single-digit.
7 Any positive integer may be multi-digit.
4 Any integer may be multi-digit.