Also you are writing string str there making array of string
You don’t need those square brackets while defining or taking input.
And remember that indexing starts from 0 to N-1…so instead of str[7] use str[6]
These two changes should do it and remember in most case including the header file i mentioned will cut you a lot of hassle so use it regularly
Good luck