Remove special character in an string



Problem to remove special character in a string.



Example-1:


Input    : S = "@my#crazy$coding*"
Output   : mycrazycoding  


Example-2:


Input    : S = "@$helloworld*!"
Output   : helloworld 







Solution




n = "@my#crazy$coding*"

d = ""

for i in range(len(n)):

    if(n[i].isalnum()):

        d += n[i]

print(d)



Output



mycrazycoding