国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 大庆市| 邵阳县| 义乌市| 山阴县| 河源市| 高州市| 六安市| 贡嘎县| 金溪县| 永胜县| 礼泉县| 巫溪县| 陇川县| 高陵县| 太湖县| 张北县| 民勤县| 永州市| 翁源县| 武平县| 福海县| 南乐县| 会宁县| 清远市| 普格县| 洛南县| 霍城县| 临漳县| 松江区| 合山市| 太和县| 收藏| 齐齐哈尔市| 板桥市| 西宁市| 阿拉善右旗| 吉木萨尔县| 溧阳市| 莆田市| 无棣县| 潮安县|