I mean, since you've told us that the input is of form like you've shown to us, there apparently are 's and spaces to be discarded. If so, it is almost as if you have to parse an input...
If you are certain that the input will be of the form you've described, then one way to do it would be to:
- Read and discard until the first single-quote, then also the single-quote
- Read and store the following character
- Read and discard the following single-quote
- Do this once again
On each loop. What I have described above, could be achieved with the following block consisting of a single scanf call, where the format-string is the important part:
for ( ... ) {
scanf( "%*[^']'%c'%*[^']'%c'", &arr1[i], &arr2[i] );
}
This assumes that the input will be of the form as displayed on the question, with a single-character inside single-quotes, arbitrarily spaced, and like that.
%*[^']' part handles the first bullet on the list above
%c and the paired &arr1[i] does the second
' does the third
- Rest does the fourth
I know that, as per asker's comment, that this is not what's being looked for, however I felt like there should at least be an answer addressing what the question says and not just what the asker thinks, with the hope that it helps anybody.
's and all? Or is it rather like,fgthen a new-line, thendb, and so on?