Here in the program how can you find the second repetitive character in the string. for ex:abcdaabdefaggcbd" Output : d (because 'd' occurred 3 times where 'a' occurred 4 times) how can I get the output, please help me.
Given below is my code:
s="abcdaabdefaggcbd"
d={}
for i in s:
d[i] = d.get(i,0)+1
print(d,"ddddd")
max2 = 0
for k,v in d.items():
if(v>max2 and v<max(d.values())):
max2=v
if max2 in d.values():
print k,"kkk"