I'm doing an exercise about C++
The structure of the Input is:
- Line 1: The string S1 consists of consecutive 0 and 1
- Line 2: The string S2 consists of a sequence of character pairs am, bn, (m, n are integers) (1<=m,n<=100)
The request is: Transform the string S1: Going from left to right of the string s1, if there is a consecutive segment consisting of m 1's, replace it with the string am, if there is a consecutive segment of n 0's, replace it with the string bn, and so on. to the end of the string. With the string s2, do opposite.
example: INPUT: 11001010 a5b3a4
OUTPUT: a2b3a1b1a1b1 111110001111
Help me code this in C++ please. Thank you!
Aucun commentaire:
Enregistrer un commentaire