@ritik_99
I know what frearr[s[i]] ++ means. And you seem to be saying the same thing as well, but still your implementation is wrong. It will only update the index at which s[i] character is present if that index exists in your array. Your array is of size 50 and it is trying to access 97th index for character ‘a’. Similarly it will try to access index 122 for ‘z’ , both of which are out of bounds.
There will be no problem in compiling since this is a runtime problem.
Also , your code is giving an output, the cout statement is working. Just not how you want it to because of the above mentioned problem.
Your ch is initialised to a blank space. It is never updated because the if condition would never work and hence your code prints a blank space only as final output.
Try initialising your ch as some character , say ch=‘x’. And then give a string as input which doesn’t contain an ‘x’ at all. Try your code then.