国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

1112. Stucked Keyboard (20)

2019-11-08 19:52:41
字體:
供稿:網(wǎng)友

1112. Stucked Keyboard (20)

時(shí)間限制 400 ms內(nèi)存限制 65536 kB代碼長(zhǎng)度限制 16000 B判題程序 Standard 作者 CHEN, Yue

On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times.

Now given a resulting string on screen, you are supposed to list all the possible stucked keys, and the original string.

Notice that there might be some characters that are typed repeatedly. The stucked key will always repeat output for a fixed k times whenever it is PRessed. For example, when k=3, from the string "thiiis iiisss a teeeeeest" we know that the keys "i" and "e" might be stucked, but "s" is not even though it appears repeatedly sometimes. The original string could be "this isss a teest".

Input Specification:

Each input file contains one test case. For each case, the 1st line gives a positive integer k ( 1<k<=100 ) which is the output repeating times of a stucked key. The 2nd line contains the resulting string on screen, which consists of no more than 1000 characters from {a-z}, {0-9} and "_". It is guaranteed that the string is non-empty.

Output Specification:

For each test case, print in one line the possible stucked keys, in the order of being detected. Make sure that each key is printed once only. Then in the next line print the original string. It is guaranteed that there is at least one stucked key.

Sample Input:

3caseee1__thiiis_iiisss_a_teeeeeest

Sample Output:

eicase1__this_isss_a_teest

a=int(input())b=input()arra={}i=0answer=[]j=' 'while i < (len(b)):    if b[i] not in arra:        arra[b[i]]=0        answer.append(b[i])    if arra[b[i]]>=0:        if b[i:i+a]==b[i]*a:            arra[b[i]]=1            i+=a-1        else:            arra[b[i]]=-1    i+=1for i in answer:    if arra[i]==1:        print(i,end="")print("")i=0while i < (len(b)):    if arra[b[i]]==1:        i+=a-1    print(b[i],end="")    i+=1感想:第一次用py寫代碼,主要是一些語法的問題
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 隆化县| 米林县| 白朗县| 建宁县| 始兴县| 凤冈县| 云梦县| 永德县| 鹤庆县| 开阳县| 抚宁县| 临泉县| 禹州市| 新源县| 汤原县| 阿鲁科尔沁旗| 淮北市| 嘉善县| 麟游县| 明水县| 雅江县| 斗六市| 公安县| 陆丰市| 孟村| 乐亭县| 武城县| 子洲县| 镇沅| 怀来县| 宽城| 南召县| 象州县| 盐城市| 固安县| 京山县| 马边| 中卫市| 鄂伦春自治旗| 麦盖提县| 安义县|