Skip to content

Instantly share code, notes, and snippets.

@yaraxxx
Last active February 26, 2020 16:49
Show Gist options
  • Save yaraxxx/9dca276ef603a6e51e5aac01b6f5733d to your computer and use it in GitHub Desktop.
Save yaraxxx/9dca276ef603a6e51e5aac01b6f5733d to your computer and use it in GitHub Desktop.
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