Same letters
Statement
Goal
Write shortest program that prints out letters that appears more than once in a sentence, sorted by the index of their first occurrence inside the sentence, reading from left to right.Only print letters, not other characters.
Example: "ab11ba"
Correct Output: ab
Wrong Output: 1ba
Example: "This is my first Clash of Code :)))"
Correct Output: hisfCo
Program must consider letter casing, so letter T and t appears only once.
Letters inside output string are sorted by index of their first occurrence inside the sentence, reading from left to right.
If there are no letters that repeats inside sentence, correct output is word NONE
.
Input
Line 1: An integer N for the number of sentences in test case
Next N lines: string S for the text of sentence to examine.
Next N lines: string S for the text of sentence to examine.
Output
For each sentence in a test case, print out string containing all letters that appear more than once inside the sentence, sorted by the index of their first occurrence inside the sentence, reading from left to right.
If there are no such letters, print out word NONE
If there are no such letters, print out word NONE
Constraints
0 < N < 10
0 < Length of S < 101
0 < Length of S < 101
Example
Input
4 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 11223344556677889900 &&&&&&&& ......::::----_____><><><><
Output
NONE NONE NONE NONE
Game modes
Fastest, Shortest
Test cases
NONE Test
Input
4
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
11223344556677889900
&&&&&&&&
......::::----_____><><><><
Output
NONE
NONE
NONE
NONE
NONE Validator
Input
2
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz..!!))11223344556677&&""
""&&77665544332211))!!..zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA
Output
NONE
NONE
Hello World Test
Input
1
HHeelloo WWoorrlldd !!
Output
HeloWrd
Hello World Validator
Input
1
WWoorrlldd,,HHeelloo..
Output
WorldHe
Single Double Test
Input
5
HH
ee
ll
ll
oo
Output
H
e
l
l
o
Single Double Validator
Input
5
HH
ee
ll
ll
oo
Output
H
e
l
l
o
Bigger Test Test
Input
1
PppAaaSssEeeDdd
Output
pased
Biggest Test Validator
Input
1
PPpAaaSssEeeDddPPpAaaSssEeeDddPPpAaaSssEeeDddPPpAaaSssEeeDddPPpAaaSssEeeDddPPpAaaSssEeeDdd
Output
PpAaSsEeDd
Case Check Test
Input
2
aAbB
BAaAbb
Output
NONE
Ab
Case Check Validator
Input
2
abcCAB
KAkaKA
Output
NONE
KA
Order Check Test
Input
1
abcdefggfedcba
Output
abcdefg
Order Check Validator
Input
1
ordercheckkcehcredro
Output
ordechk
Solution language
Solution
Stub generator input