Skip to content

Commit ce3b2bf

Browse files
authored
Create concatenated_string_with_uncommon_characters_of_two_strings.py
1 parent fc100d8 commit ce3b2bf

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# coding: utf-8
2+
3+
class Solution:
4+
"""
5+
@param: : the 1st string
6+
@param: : the 2nd string
7+
@return: uncommon characters of given strings
8+
"""
9+
10+
def concatenetedString(self, s1, s2):
11+
# write your code here
12+
di_1, di_2 = {}, {}
13+
for c in s1:
14+
if c not in s1:
15+
s1[c] = True
16+
for c in s2:
17+
if c not in s2:
18+
s2[c] = True
19+
li = []
20+
for c in s1:
21+
if c not in s2:
22+
li.append(c)
23+
for c in s2:
24+
if c not in s1:
25+
li.append(c)
26+
return ''.join(li)
27+
28+
# easy: http://lintcode.com/zh-cn/problem/concatenated-string-with-uncommon-characters-of-two-strings/

0 commit comments

Comments
 (0)