Question: Is it possible to reverse an array without affecting the special characters ? By special characters, I mean anything characters not included from 'a' to 'z' and 'A' to 'Z'. I am short of ideas to build the algorithm, I still haven't it figured out.

Answer: 
Here's a solution that will do it "in place" in one pass.

```
bool isspecial(char c)
{
    if ((c >= 'a') && (c <= 'z')) return false;
    if ((c >= 'A') && (c <= 'Z')) return false;
    return true;
}

void rev(char* array, int N)
{
    int i = 0;     // i points to the first index of the array 
    int j = N - 1; // j points to the last index of the array

    while (i < j)
    {
        if (isspecial(array[i]))
        {
            i++;
        }
        else if (isspecial(array[j]))
        {
            j--;
        }
        else
        {
            char tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
            i++;
            j--;
        }
    }
}

```
If you want the position of the special characters to remain the same and the rest of the string to be reversed then this should work -

```
#include <iostream>
using namespace std;

void swap(char& a, char& b)
{
    char temp = a;
    a = b;
    b = temp;
}

int main()
{
   string s = "Hell$o World"; 
   for(int i = 0, j = s.length() -1;i < s.length()/2; i++, j--) {
       while((s[i] <= 'a' && s[i] >= 'Z') || s[i] >= 'z' || s[i] <= 'A') {
           i++;
       }
       while((s[j] <= 'a' && s[j] >= 'Z') || s[j] >= 'z' || s[j] <= 'A') {
           j--;
       }
       swap(s[i], s[j]);
   }
   cout << s << endl;     //dlro$W olleH
   return 0;
}

```