I can't tell you exactly how to do this, but here's what I'll think you'll need to do the job:
The letters are actually a separator for the numbers, so if you can "scan" the string character by character, you know that as long as you don't find a letter the current character should be on the same line as the previous. In pseudo code:
filestream f;
temp string tmp;
read f character by character;
if character != A then add character to tmp
else add '\n' to tmp (for linebreak)
Hope that makes sense and will get you started.
There may be more effective ways to do this, but as it appears that your first file contains just a string (no seperate lines) I'm guessing the above is the way to go.
Another route may be to load the string and loop over a first position search of 'A', then using substring to fetch the data and strip it from the loaded string.