Question: I have a long list of names and i have to count number of times each name has come up. However the names are mixed with spaces. 

Here is the simple example

```
x <- c(" John D","John D ","John D")
table(x)
x
 John D  John D John D  
      1       1       1 

```

You can see because of the spaces it is recognizing as three different names. What i have to do is without loosing the Space between John and D, I have to remove remaining spaces.
Please help. Thanks.

Answer: 
```
    I have tried casting like
    arr[end] = (char) arr[start] ^ arr[end];

```

You are only casting the first `char` but not the other one thus giving you the result of `xor` in `integer/decimal value` of char not the `char value` itself.

**sample:**

instead you can wrap it in parenthesis and cast the result of the manipulation to char.

```
(char) (arr[start] ^ arr[end]);

```
Try to cast the whole expression:

```
arr[end] = (char) (arr[start] ^ arr[end]);

```