Your program output is
The first problem with your code is that it is very specific to the data -- an extra dash in the data would completely change your results. And the problem statement was to remove hyphens "or other special characters" which your code does not do.
The second problem you have is that your variable is 13 bytes yet your subscripts are only one-byte variables. So X goes from 1 to 3 to 5 to 9 to ... 1 again since a one-byte variable won't ever be more than 9.
The problem statement provided is woefully inadequate. How long can the input variable be? Can it have numbers? if so, are numbers considered valid or invalid characters? What are the invalid characters?