Non Duplicate String | Accenture Solve

Python

from collections import OrderedDict

def removeDupWithOrder(str):
	return "".join(OrderedDict.fromkeys(str))

if __name__ == "__main__":
	str = input()
	print (removeDupWithOrder(str))

Alternative Solution

Python

def removeDuplicate(str):
	
	t=""
	for i in str:
		if(i in t):
			pass
		else:
			t=t+i
	print(t)
	
str=input()
removeDuplicate(str)

Leave a Comment

Your email address will not be published. Required fields are marked *