| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 13174 | GEC1506 - Basic - eliminate duplicated characters |
|
| 13175 | Print multiple times |
|
| 13176 | GEC1506 - medium - eliminate unwanted elements |
|
Description
Given a list of string elements, remove duplicated characters for each string element.
Input
The input consists of two lines:
- A list of string elements presented in the one-line text with each element separated by a special separator string
- The separator string
You need to remove the duplicated characters in each element. (Case insensitive)
For example, in the sample input,
- There are duplicated
cin the first elementEricc, it should be modified asEri. - For element
rRita, theris duplicated withR, it should be modified asita.
Note that you can use lower() in python to help you to check the characters.
text = "Ericc"
text_lower = text.lower()
print(text_lower) # "ericc"
To retrieve the character, you can use list index:
print(text_lower[0]) # "e"
Output
Print out a line of elements with duplicated characters of each element removed, where each element are connected by the above separator string in the input.
Note that there will be a new line default by python's print() function. If you are using python's print(), just ignore this line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a specific line of text including text and operators, you need to print out the text and the operator for a multiple times.
Input
There's a line of text with the following syntax:
e1,e2,e3
Note that:
1. Each element is separated by a ',' token.
2. e1, e2 ,e3 represented 3 elements from given text.
Output
A line of text with the following operations:
e1: Representing the number of times of e2 needed to be printed.
e2: Representing the word that needs to be printed.
e3: Representing the operator that separates each of the word e2, and it should also exist in the beginning and in the end.
For example, the output would be like this:
e3e2e3e2......e3e2e3 <--- e2 exists e1 times.
Note that:
1. There will be no connection elements between e2 and e3 for your output.
2. There will be a new line default by python's print() function. If you are using python's print(), just ignore this point.
3. You can use split() function to separate the elements from one string.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a set of elements and another set of unwanted elements, remove the unwanted elements.
Input
There are two lines for the input, which are
- The set of elements
- The set of unwanted elements
e1 e2 e3 ... en <--- elements 1~n
u1 u2 ... um <---- unwanted elements 1~m
Note that
- Each element is separated by a SPACE token.
- You need to remove the elements e which also exist in u. (Case sensitive)
Hint: You can use an index to find an element in a list
elements = [1, 2, 3]
print(elements[1]) # 2
Output
Print out a line of elements with unwanted elements removed, where each element are connected by a SPACE token (" ").
Note that there will be a new line default by python's print() function. If you are using python's print(), just ignore this line.