Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Comma Saperated Values
2
some#important#data
gulf$open|programming%contest
def cal():
line = input()
counter = 0
for i in range(len(line)):
if(line[i] == '#' or line[i] == '$' or line[i] == '#' or line[i] == '%' or line[i] == '|'):
line = line.replace(line[i],',',1)
counter+=1
return line , counter
def main():
t = int(input())
for case in range(t):
line , counter = cal()
print(line+','+str(counter+1)) # I added one to count to count the last word
if __name__=="__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment