0
Iterating creates problem[Haven't found solution yet]
When I am running this code for a single time it gives proper answer. But when I am trying for multiple test case using loop then it gives an extra output line for first iteration and doesn't run for the last test case. Sample Input and output have given in the top of the as comment. This code is written to show, maximum frequent letters in the inputted string. https://www.sololearn.com/compiler-playground/cD9fFymoJPhi
3 Antworten
+ 1
KAZI FAISAL MAHMUD it seems the newline after the input number is causing a problem. It is still in the input buffer after reading the number, so the first string is only the newline. If you enter the first string on the same line as the number, the results look good.
Try it this way:
3 Computers...
...
...
+ 1
To work around the unwanted newline, you could use getline and convert the string to an int.
A simpler option would be to add a dummy input string to the cin after the int so that it reads the newline after reading the int.
0
It is not possible to change the input.