아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Classical A+B Problem

시간 제한4초메모리 제한1024 MB

요약
4000자리 이하의 큰 양의 정수 n이 주어질 때, n = a + b를 만족하는 두 양의 렙디지트 a와 b를 찾는다.
난이도

보통10점 중 7점

유형
수학, 구현, 완전 탐색, 문자열 매칭
정답자
아직 제출이 없습니다

문제

An integer is called a repdigit if it is positive and its decimal representation consists of repeated instances of the same digit. For example, 11, 666666, 44444444, and 999999999999 are repdigits, while 00, 4424444244, 5021650216, and 787788787788 are not.

You are given a positive integer nn. It is known that nn can be represented as n=a+bn = a + b, where aa and bb are repdigits. Find any such representation.

입력

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1041 \le t \le 10^4). The description of the test cases follows.

The only line of each test case contains a single integer nn without leading zeros (2≤n<1040002 \le n < 10^{4000}). It is guaranteed that nn can be represented as n=a+bn = a + b, where aa and bb are repdigits.

It is guaranteed that the total number of digits in nn over all test cases does not exceed 10510^5.

출력

For each test case, print two integers aa and bb such that n=a+bn = a + b and both aa and bb are repdigits.

If there are multiple solutions, print any of them.

예제1

  1. 예제 1

    입력
    6
    2
    786
    1332
    89110
    2333333
    10000000000000000000000000001
    
    예상 출력
    1 1
    777 9
    333 999
    88888 222
    2222222 111111
    9999999999999999999999999999 2