First N Repeated characters



rb=input().strip()

n=int(input())

dic={};li=[]

for i in rb:

    if i not in dic:

        dic[i]=1

    else:

        dic[i]+=1

        if i not in li:

            li.append(i)

    if len(li)==n:

        break

for i in rb:

    if i in li:

        print(i,end="")

Post a Comment

0 Comments