Submit | All submissions | Best solutions | Back to list |
RIOI_2_1 - Missing one |
You are given string S. Find lexicographically smallest string, that is not subsequence of given string. Subsequence of string is created by deleting zero or more characters from starting string.
Subsequences of string "abc" are { "a", "b", "c", "ab", "ac", "bc", "abc" }
Constraints
|S| <= 10000
Input
First line of the input is number t (t <= 10000) denoting number of test cases. t lines follows, each containing string S, length of each string is at max 10000 (10^4).
Output
Output t strings, solution to each test.
Example
Input: 2 bcd abcdefghijklmnnjoprstuvjklmqyz Output: a aa
Added by: | Buda IM |
Date: | 2012-11-01 |
Time limit: | 0.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM32-GCC MAWK BC C-CLANG NCSHARP CPP14 CPP14-CLANG COBOL COFFEE D-CLANG D-DMD DART ELIXIR FANTOM FORTH GOSU GRV JS-MONKEY JULIA KTLN NIM OBJC OBJC-CLANG OCT PICO PROLOG PYPY PYPY3 R RACKET RUST CHICKEN SQLITE SWIFT UNLAMBDA VB.NET |
Resource: | Known problem |