Love丶FFC's Blog
给定两个字符串 A 和 B,本题要求你输出 A+B,即两个字符串的并集。要求先输出 A,再输出 B,但重复的字符必须被剔除。
输入在两行中分别给出 A 和 B,均为长度不超过 106的、由可见 ASCII 字符 (即码值为32~126)和空格组成的、由回车标识结束的非空字符串。
在一行中输出题面要求的 A 和 B 的和。
This is a sample test
to show you_How it works
This ampletowyu_Hrk
例如A="sdswdfrfe ss ",采用如下算法。
1.对于's',替换掉A[1:]之后的's'。然后将A[:1]+"dwdfrfe "赋给A
2.重复第一步,此时A="sdwdfrfe ",替换掉A[2:]之后的'd'。然后将A[:2]+"wfrfe "赋给A
3.重复第一步。······
4.最终就得到A="sdwfre "
对于本题,需要对两个输入的字符串都采用这样的方法去重,然后将两个字符串相加构成新的字符串,再采用这样的方法去重。不能使用集合,集合虽然可以很简单的实现去重,但是不能保证顺序
def Deduplication(String): i = 0 while i < len(String): # 逐位向右遍历 String = String[:i + 1] + String[i + 1:].replace(String[i], '') # 新字符串 = 该位字符以及之前部分的字符串 + 该位字符之后部分替换掉该字符的字符串 i += 1 return String StringA = input() StringB = input() print(Deduplication(Deduplication(StringA) + Deduplication(StringB))) # 将两个字符串去重后的结果相加当做参数再做一次去重
fruinly
buy cialis and viagra online The absolute survival benefit ASB method was rated as the most helpful method by a significant majority of respondents
louis vuitton outlet
I just wanted to thank you for the fast service. nicely they look great. I received them a day earlier than expected. appreciate the I will definitely continue to buy from this site. regardless I will recommend this site to my friends. Thanks!
louis vuitton outlet https://www.bestlouisvuittonoutlet.com/
louis vuitton outlet
I just wanted to thank you for the fast service. as they look great. I received them a day earlier than expected. similar to I will definitely continue to buy from this site. blue jays I will recommend this site to my friends. Thanks!
louis vuitton outlet https://www.louisvuittonsoutletstore.com/
original louis vuittons outlet
I just wanted to thank you for the fast service. also they look great. I received them a day earlier than expected. for instance the I will definitely continue to buy from this site. manner in which I will recommend this site to my friends. Thanks!
original louis vuittons outlet https://www.cheaplouisvuittonoutlets.com/
FoorryNox
cialis pfizer levitra comparaison Perren A, Markmann M, Merlani G, Marone C, Merlani P
cheap real jordans
Read reviews and was a little hesitant since I had already inputted my order. also known as but thank god, I had no issues. which includes the received item in a timely matter, they are in new condition. blue jays so happy I made the purchase. Will be definitely be purchasing again.
cheap real jordans https://www.cheapretrojordan.com/
cheap jordan shoes
Read reviews and was a little hesitant since I had already inputted my order. or simply but thank god, I had no issues. similar to received item in a timely matter, they are in new condition. in either case so happy I made the purchase. Will be definitely be purchasing again.
cheap jordan shoes https://www.realjordansretro.com/
jordans for cheap
Read reviews and was a little hesitant since I had already inputted my order. or even a but thank god, I had no issues. simillar to the received item in a timely matter, they are in new condition. blue jays so happy I made the purchase. Will be definitely be purchasing again.
jordans for cheap https://www.realjordansshoes.com/
original louis vuittons outlet
Read reviews and was a little hesitant since I had already inputted my order. or possibly a but thank god, I had no issues. just like received item in a timely matter, they are in new condition. no matter what so happy I made the purchase. Will be definitely be purchasing again.
original louis vuittons outlet https://www.louisvuittonsoutletonline.com/
Preliaf
buy cialis online cheap The patient was initiated on goal directed intravenous hydration, oral antiemetics, and morphine
Fwvder
fenofibrate online order order tricor 160mg pills fenofibrate 160mg us
Kpooqv
buy generic tadalafil 5mg cialis 10mg oral cost sildenafil
Rvzyof
purchase zaditor for sale buy generic sinequan order imipramine 25mg without prescription
Rfloxh
minoxytop canada tamsulosin pill best ed pills non prescription uk
Ypzvfe
order precose 50mg pills micronase 2.5mg without prescription purchase fulvicin for sale