-->
当前位置:首页 > 题库

PROGRAMMING:String minimization and de duplication

Luz5年前 (2021-05-10)题库392
Write a program to delete the repeated characters in the input string, so that the remaining string is the smallest (arranged according to the rules of character dictionary), and the remaining characters remain unchanged in the relative position of the original string.
Note: 1) all strings are lowercase letters; 2) The string length is within 9998.
###Input sample 1:
A string of lowercase letters:
```in
bbcaac
```
###Output sample 1:
Smallest string after removing duplicate strings:
```out
bac
```
###Input sample 2:
A string of lowercase letters:
```in
cbacdcbc
```
###Output sample 2:
Smallest string after removing duplicate strings:
```out
acdb
```






answer:If there is no answer, please comment