How can we print the repeated letters in a string using python programming?


Solution -


string = "Great how are you";  

for i in range(0, len(string)):  

    count = 1;  

    for j in range(i+1, len(string)):  

        if(string[i] == string[j] and string[i] != ' '):  

            count = count + 1;  

            string = string[:j] + '0' + string[j+1:];  

    if(count > 1 and string[i] != '0'):  

        print(string[i]);  


Output -     


r

e

a

o


1 Comments

  1. Best Online Casinos of 2021 | Blackjack, Roulette & More - Casino
    A complete 하랑 도메인 list of the 2021 online casinos where you can play 오즈포탈 Blackjack, Roulette & more. 1xbet korean Online Casino Sites with Great RTP - Bonuses, Promotions & 바카라 조작 More. baoji titanium

    ReplyDelete

Post a Comment

Previous Post Next Post