Love丶FFC's Blog
小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红要你帮忙判断一下,某串珠子里是否包含了全部自己想要的珠子?如果是,那么告诉她有多少多余的珠子;如果不是,那么告诉她缺了多少珠子。
为方便起见,我们用[0-9]、[a-z]、[A-Z]范围内的字符来表示颜色。例如在图1中,第3串是小红想做的珠串;那么第1串可以买,因为包含了全部她想要的珠子,还多了8颗不需要的珠子;第2串不能买,因为没有黑色珠子,并且少了一颗红色的珠子。
每个输入包含 1 个测试用例。每个测试用例分别在 2 行中先后给出摊主的珠串和小红想做的珠串,两串都不超过 1000 个珠子。
如果可以买,则在一行中输出 Yes
以及有多少多余的珠子;如果不可以买,则在一行中输出 No
以及缺了多少珠子。其间以 1 个空格分隔。
ppRYYGrrYBR2258
YrR8RrY
Yes 8
ppRYYGrrYB225
YrR8RrY
No 2
1.创建两个列表分别存放卖的珠子、买的珠子
2.遍历买的珠子,判断该珠子是否存在于卖的珠子中
3.若存在,则在两个列表中都将该珠子替换为*,不能直接替换为空,会导致循环错误
4.遍历结束后,再将两个列表的*都替换为空
5.此时,若买的珠子长度为0,则卖的珠子的长度就是多余的珠子个数
6.若买的珠子长度不为0,则买的珠子的长度就是缺少的珠子个数
SellBead = input() # 卖的珠子 BuyBead = input() # 买的珠子 for i in range(len(BuyBead)): # 遍历买的珠子 if BuyBead[i] in SellBead: # 该珠子,卖家也有 SellBead = SellBead.replace(BuyBead[i], '*', 1) # 暂时替换为* BuyBead = BuyBead.replace(BuyBead[i], '*', 1) # 暂时替换为* SellBead = SellBead.replace(' ', '') # 再将*替换为空 BuyBead = BuyBead.replace(' ', '') # 再将*替换为空 if len(BuyBead) == 0: # 珠子买齐了 print("Yes", len(SellBead)) else: # 珠子没买齐 print("No", len(BuyBead))
Abupguele
The choice of diagnostic tests and monitoring for patients with CVS AKI is determined by the presence and the degree of kidney and or cardiorespiratory dysfunction not graded generic for cialis This most commonly includes vomiting, diarrhea, or facial swelling
Outlils
Collectively, this study provides evidence for radiation induced reprogramming of cardiac conduction as a potential treatment strategy for arrhythmia management in VT patients cheap generic cialis In a multicentre study with 200 patients who suffered from septic shock due to ventilator associated pneumonia VAP, the use of clarithromycin led to significantly lower TNF О± and higher IL 6 levels than among the control group
louis vuitton outlet
I just wanted to thank you for the fast service. or even they look great. I received them a day earlier than expected. since 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.cheapreallouisvuitton.com/
cheap real jordans
I just wanted to thank you for the fast service. or it may be they look great. I received them a day earlier than expected. the same as the I will definitely continue to buy from this site. you ultimately choose I will recommend this site to my friends. Thanks!
cheap real jordans https://www.realcheapretrojordanshoes.com/
authentic louis vuitton outlet
I just wanted to thank you for the fast service. or they look great. I received them a day earlier than expected. including the I will definitely continue to buy from this site. either way I will recommend this site to my friends. Thanks!
authentic louis vuitton outlet https://www.louisvuittonsoutletstore.com/
original louis vuittons outlet
I just wanted to thank you for the fast service. quite possibly they look great. I received them a day earlier than expected. the same as I will definitely continue to buy from this site. blue jays I will recommend this site to my friends. Thanks!
original louis vuittons outlet https://www.bestlouisvuittonoutlet.com/
cheap jordans online
Read reviews and was a little hesitant since I had already inputted my order. or but thank god, I had no issues. prefer the received item in a timely matter, they are in new condition. you ultimately choose so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans online https://www.cheapauthenticjordans.com/
cheap retro jordans
Read reviews and was a little hesitant since I had already inputted my order. and even but thank god, I had no issues. themselves received item in a timely matter, they are in new condition. regardless so happy I made the purchase. Will be definitely be purchasing again.
cheap retro jordans https://www.cheaprealjordan.com/
cheap louis vuitton bags
Read reviews and was a little hesitant since I had already inputted my order. possibly but thank god, I had no issues. love the received item in a timely matter, they are in new condition. in any event so happy I made the purchase. Will be definitely be purchasing again.
cheap louis vuitton bags https://www.louisvuittonsoutletonline.com/
Gealpaste
2008; Tyzio et al cialis online cheap Anecdotally, it helps reset things for some patients
cheap jordans online
Read reviews and was a little hesitant since I had already inputted my order. or it may be but thank god, I had no issues. similar to the received item in a timely matter, they are in new condition. direction so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans online https://www.realjordansretro.com/
invoimi
com 20 E2 AD 90 20Jual 20Viagra 20Di 20Jakarta 20Barat 20 20Viagra 20Femme 20Prix jual viagra di jakarta barat At Г‚ 14, 249, the five door Sport is Г‚ 500 more than the three door model, and Suzuki claims itГў s no more expensive to run, thanks to identical 44 buy priligy tablets
invoimi
If severe bradycardia develops, reduce or stop Lopressor levitra paypal accepted
intuido
Even moving to Germany that all our writers air temperature, so fermentation this mental divide start who like to work fulfil your wishes, Buy Requip Low Price, i cialis online
jfufLkr
Gastrointestinal and prevent or ask your treatment modalities buy cialis online cheap
FiBfHIOm
Tamoxifen administered at a daily dose of 20 mg for 5 years reduced breast cancer incidence by about 50 propecia for men to buy
Zbvtnv
tricor 200mg canada buy tricor cheap tricor pills
Rqzyjy
buy ketotifen paypal ziprasidone medication tofranil 25mg canada
Jyktjk
cialis 5mg brand cost viagra order viagra 50mg pills
Abbfcg
buy precose cheap repaglinide online order fulvicin 250mg usa
Mlgokj
minoxytop order cheap cialis online buy ed pills best price