Product Codes

면접 대비

시간 제한1초메모리 제한2048 MB

요약
각 제품 코드에서 소문자를 제거하고 대문자는 순서대로 남기며, 코드에 들어 있는 모든 정수의 합을 끝에 붙입니다.
난이도

쉬움10점 중 3점

유형
문자열, 구현, 수학, 시뮬레이션
정답자
아직 제출이 없습니다

문제

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, cG23mH-9s 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 cG23mH-9s is GH14.

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, NN, representing the number of original product codes that need to be updated. The following NN 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 2323 is the integer 2323 instead of the integer 22 followed by the integer 33.

출력

Output the NN new product codes, one per line.

예제2

  1. 예제 1

    입력
    1
    AbC3c2Cd9
    
    예상 출력
    ACC14
    
  2. 예제 2

    입력
    3
    Ahkiy-6ebvXCV1
    393hhhUHkbs5gh6QpS-9-8
    PL12N-2G1234Duytrty8-86tyaYySsDdEe
    
    예상 출력
    AXCV-5
    UHQS387
    PLNGDYSDE1166