I've started working on hackerrank/hackerearth like sites. There i've found one problem fetching input. Its easy in Java.
Consider a very simple problem of reading input and displaying it : Flow is like :
read A
repeat A times
read X1,N1,X2,N2 ; where Xi is any string, Ni is any integer.
display X1+X2, N1+N2
i don't know how to read X1,N1,X2,N2 where X1 and X2 are strings, i've also tried but problem is that when i read first string it reads entire line for eg when i read string it supposed to be X1 but it is X1,N1,X2,N2. code that i used is
scanf("%s,%d,%s,%d", x1, &n1, x2, &n2)
thanks in advance and sorry for my bad english.
Update#1:
example lines :
3
some,123,thing,456
something,579
a,1,b,2
ab,3
hello,100,world,100
helloworld,200