I have doubts about the string input and output while solving the question.
For each test case, we take the string as input and print the same string with slide modification.
Modification: For every character in the string we have to replace that character with its next succession(alphabetically).
qwerty -> rxfsuz
zub -> avc
Now the way I do this is
- Begin the loop for every test case
- Read the first string with cin>>_string_var;
- Traverse through each character and printing that character with adding one for a successor(for z printing the a)
- now the answer for the first Test case is successfully printed, cout<<"\n".
- Moving to the next string and repeat…
Now is this the right approach to print the answer character by character? will this approach will get WA in any question?
Instead of printing the answer character by character I should create a temporary string and append the character to print the answer?
Or there is something else which I need to keep in mind?