Fill an Array with Values
Since your values are all constant you can define them all as constant values and just select between them. The simplest way is to add an extra dimension to your arrays:

const char pins[2][13] = 
    {'O','O','I','I','O','I','I','I','I','O','I','I','O'},
    {'O','I','I','O','O','I','O','O','I','O','I','O','I'}
};

for(byte i = 0; i &lt; 13; i++) {
    if(pins[mode][i] == 'I') pinMode(i, INPUT);
    else pinMode(i, OUTPUT);
}


(Note: An array of size 13 has entries 0-12.)

However, that is very inefficient.  Since you only have two states, I and O, and there are only 13 entries, you can store each array as a single 16-bit value:

const uint16_t pins[2] = {
    0b0110111101100,
    0b1010100100110
};

for(byte i = 0; i &lt; 13; i++) {
    if((pins[mode] &amp; (1 &lt;&lt; i)) pinMode(i, INPUT);
    else pinMode(i, OUTPUT);
}


(Note: the data is stored backwards - pin 0 is on the right, pin 12 on the left.)