- #1
sandy.bridge
- 798
- 1
Hey. I am working on an algorithm that receives an input in the form "4A3B2H9P" (depending on the users choice of input), and I want it to output "AAAABBBHHPPPPPPPPP". I have tried searching online for ways to "scan" the string, but I cannot seem to find anything. Same goes for me textbook.
Is there a way to scan, from left to right, the string, such that it stops scanning the number once a letter is reached? For example "12A4B", stop scanning after the two, detects 12. Then, scans further and scans until 4, detects A.
Or is there some easier method I can employ? Thanks in advance.
Is there a way to scan, from left to right, the string, such that it stops scanning the number once a letter is reached? For example "12A4B", stop scanning after the two, detects 12. Then, scans further and scans until 4, detects A.
Or is there some easier method I can employ? Thanks in advance.