'use strict'

const s = readline().split('');
const n = s.length;
const take = [].reduce.call('abcdefghijklmnopqrstuvwxyz', (r, i, j) => { r[i] = j; return r; }, {});
const bit = Array.from({ length: 26 }, () => Array(n + 1).fill(0))

const upd = (b, i, v) => {
    while (i <= n) { b[i] += v; i += i&-i; }
}

const query = (b, i) => {
  let r = 0;
  while (i) { r += b[i]; i -= i&-i; }
  return r;
}

for (let i = 0; i < n; i++) {
    upd(bit[take[s[i]]], i + 1, 1);
}

let q = parseInt(readline());
while(q--) {
    const t = readline().split(' ');
    if (t[0] === '1') {
        const j = parseInt(t[1]) - 1;
        upd(bit[take[s[j]]], j + 1, -1);
        upd(bit[take[t[2]]], j + 1, 1);
        s[j] = t[2];
    } else {
        const l = parseInt(t[1]) - 1;
        const r = parseInt(t[2]);
        write(bit.filter(b => query(b, r) > query(b, l)).length + '\n');
    }
}

'use strict'

const s = readline();
const q = parseInt(readline());
const az = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ];
const LEN = s.length;
const BIT = az.reduce((r, i) => { r[i] = Array(LEN+1).fill(0); return r; }, {});
const S = s.split('');

const upd = (v, w, moji) => {
  while (v < LEN + 1) {
    BIT[moji][v] += w;
    v += v & -v;
  }
}

const getValue = (v, moji) => {
  let r = 0;
  while (v) {
    r += BIT[moji][v];
    v -= v & -v;
  }
  return r;
}

S.forEach((i, index) => upd(index + 1, 1, i));

for (let i = 0; i < q; i++) {
  const A = readline().split(' ');
  if (A[0] === '1') {
    const j = parseInt(A[1]) - 1;
    upd(j+1, -1, S[j]);
    upd(j+1, 1, A[2])
    S[j] = A[2];
  }
  else {
    const l = parseInt(A[1]) - 1;
    const r = parseInt(A[2]);
    write(az.filter(i => getValue(r, i) > getValue(l, i)).length + '\n');
  }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  const strArray = str.split('')
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let fenwick = {}
  for(let i = 0; i < 26; i++) {
    fenwick[i] = new FenwickTree(n)
  }
  // console.log(fenwick)

  for(let i = 0; i < n; i++) {
    fenwick[strArray[i].charCodeAt() - 97].increase(i + 1, 1)
  }

  for(let i = 0; i < q; i++) {
    const ax = arr[i].split(' ')
    // console.log(ax)
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = ax[2][0] > '9' ? ax[2][0] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = strArray[pos].charCodeAt(0) - 97
      if(char != prev){
        strArray[pos] = r
        fenwick[prev].increase(l, -1)
        fenwick[char].increase(l, 1)
      }
    }

    else{
      let count = 0
      for(let i = 0; i < 26; i++) {
        // console.log(fenwick[i], fenwick[i].queryRange(l,r))
        // console.log(l, r, fenwick[i].queryRange(l,r), i)
        // console.log(l,r, i)
        count += fenwick[i].queryRange(l,r) > 0 ? 1 : 0
      }
      console.log(count)
    }
  }
})

class FenwickTree {
  /**
   * Constructor creates empty fenwick tree of size 'arraySize',
   * however, array size is size+1, because index is 1-based.
   *
   * @param  {number} arraySize
   */
  constructor(arraySize) {
    this.arraySize = arraySize;

    // Fill tree array with zeros.
    this.treeArray = Array(this.arraySize + 1).fill(0);
  }

  /**
   * Adds value to existing value at position.
   *
   * @param  {number} position
   * @param  {number} value
   * @return {FenwickTree}
   */
  increase(position, value) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    for (let i = position; i <= this.arraySize; i += (i & -i)) {
      this.treeArray[i] += value;
    }

    return this;
  }

  /**
   * Query sum from index 1 to position.
   *
   * @param  {number} position
   * @return {number}
   */
  query(position) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    let sum = 0;

    for (let i = position; i > 0; i -= (i & -i)) {
      sum += this.treeArray[i];
    }

    return sum;
  }

  /**
   * Query sum from index leftIndex to rightIndex.
   *
   * @param  {number} leftIndex
   * @param  {number} rightIndex
   * @return {number}
   */
  queryRange(leftIndex, rightIndex) {
    if (leftIndex > rightIndex) {
      throw new Error('Left index can not be greater than right one');
    }

    if (leftIndex === 1) {
      return this.query(rightIndex);
    }

    return this.query(rightIndex) - this.query(leftIndex - 1);
  }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

const readline = () => {
    return inputString[currentLine++];
}

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});

class IMergeStrategy {
    constructor() {}
    Execute() {

    }
}

class BitwiseOrStrategy extends IMergeStrategy {
    constructor() {
        super();
    }
    Execute(left, right) {
        return left | right;
    }
}

class SegmentTree {

    constructor(mergeStrategy, outOfBound, n) {
        if (!(mergeStrategy instanceof IMergeStrategy)) {
            throw new TypeError;
        }
        this._mergeStrategy = mergeStrategy;
        this._outOfBound = outOfBound;
        this.tr = new Array(n * 4);
    }

    Update(node, b, e, idx, x) {
        if (b == e) {
            this.tr[node] = x;
            return;
        }
        const left = node << 1;
        const right = left | 1;
        const mid = (b + e) >> 1;
        if (idx <= mid) this.Update(left, b, mid, idx, x);
        else this.Update(right, mid + 1, e, idx, x);
        this.tr[node] = this._mergeStrategy.Execute(this.tr[left], this.tr[right]);
    }

    Query(node, b, e, l, r) {
        if (r < b || e < l) return this._outOfBound;
        if (b >= l && e <= r) {
            return this.tr[node];
        }

        const left = node << 1;
        const right = left | 1;
        const mid = (b + e) >> 1;

        const p1 = this.Query(left, b, mid, l, r);
        const p2 = this.Query(right, mid + 1, e, l, r);

        return this._mergeStrategy.Execute(p1, p2);
    }
}

let s;

const bitCount = (n) => {
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

function main() {
    while (s = readline()) {
        const q = parseInt(readline());
        const n = s.length;
        const bitwiseOrStrategy = new BitwiseOrStrategy();
        const tree = new SegmentTree(bitwiseOrStrategy, 0, n);
        let ans = '';
        for (let i = 0; i < n; i++) {
            tree.Update(1, 0, n - 1, i, 1 << (s.charCodeAt(i) - 'a'.charCodeAt(0)));
        }
        for (let i = 0; i < q; i++) {
            const [ty, a, b] = readline().split(' ');
            if (ty == 1) {
                const l = parseInt(a);
                tree.Update(1, 0, n - 1, l - 1, 1 << (b.charCodeAt(0) - 'a'.charCodeAt(0)));
            } else{
                const l = parseInt(a);
                const r = parseInt(b);
                const qr = tree.Query(1, 0, n - 1, l - 1, r - 1);
                ans += bitCount(qr).toString() + '\n';
            }
        }
        console.log(ans);
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

const readline = () => {
    return inputString[currentLine++];
}

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});

class IMergeStrategy {
    constructor() {}
    Execute() {

    }
}

class BitwiseOrStrategy extends IMergeStrategy {
    constructor() {
        super();
    }
    Execute(left, right) {
        return left | right;
    }
}

class SegmentTree {

    constructor(mergeStrategy, outOfBound, n) {
        if (!(mergeStrategy instanceof IMergeStrategy)) {
            throw new TypeError;
        }
        this._mergeStrategy = mergeStrategy;
        this._outOfBound = outOfBound;
        this.tr = new Array(n * 4);
    }

    Update(node, b, e, idx, x) {
        if (b == e) {
            this.tr[node] = x;
            return;
        }
        const left = node << 1;
        const right = left | 1;
        const mid = (b + e) >> 1;
        if (idx <= mid) this.Update(left, b, mid, idx, x);
        else this.Update(right, mid + 1, e, idx, x);
        this.tr[node] = this._mergeStrategy.Execute(this.tr[left], this.tr[right]);
    }

    Query(node, b, e, l, r) {
        if (r < b || e < l) return this._outOfBound;
        if (b >= l && e <= r) {
            return this.tr[node];
        }

        const left = node << 1;
        const right = left | 1;
        const mid = (b + e) >> 1;

        const p1 = this.Query(left, b, mid, l, r);
        const p2 = this.Query(right, mid + 1, e, l, r);

        return this._mergeStrategy.Execute(p1, p2);
    }
}

let s;

const bitCount = (n) => {
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

function main() {
    while (s = readline()) {
        const q = parseInt(readline());
        const n = s.length;
        const bitwiseOrStrategy = new BitwiseOrStrategy();
        const tree = new SegmentTree(bitwiseOrStrategy, 0, n);
        for (let i = 0; i < n; i++) {
            tree.Update(1, 0, n - 1, i, 1 << (s.charCodeAt(i) - 'a'.charCodeAt(0)));
        }
        for (let i = 0; i < q; i++) {
            const [ty, a, b] = readline().split(' ');
            if (ty == 1) {
                const l = parseInt(a);
                tree.Update(1, 0, n - 1, l - 1, 1 << (b.charCodeAt(0) - 'a'.charCodeAt(0)));
            } else{
                const l = parseInt(a);
                const r = parseInt(b);
                const qr = tree.Query(1, 0, n - 1, l - 1, r - 1);
                console.log(bitCount(qr));
            }
        }
        console.error('---');
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

const readline = () => {
    return inputString[currentLine++];
}

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});

class IMergeStrategy {
    constructor() {}
    Execute() {

    }
}

class BitwiseOrStrategy extends IMergeStrategy {
    constructor() {
        super();
    }
    Execute(left, right) {
        return left | right;
    }
}

class SegmentTree {

    constructor(mergeStrategy, outOfBound, n) {
        if (!(mergeStrategy instanceof IMergeStrategy)) {
            throw new TypeError;
        }
        this._mergeStrategy = mergeStrategy;
        this._outOfBound = outOfBound;
        this.tr = new Array(n * 4);
    }

    Update(node, b, e, idx, x) {
        if (b == e) {
            this.tr[node] = x;
            return;
        }
        const left = node << 1;
        const right = left | 1;
        const mid = (b + e) >> 1;
        if (idx <= mid) this.Update(left, b, mid, idx, x);
        else this.Update(right, mid + 1, e, idx, x);
        this.tr[node] = this._mergeStrategy.Execute(this.tr[left], this.tr[right]);
    }

    Query(node, b, e, l, r) {
        if (r < b || e < l) return this._outOfBound;
        if (b >= l && e <= r) {
            return this.tr[node];
        }

        const left = node << 1;
        const right = left | 1;
        const mid = (b + e) >> 1;

        const p1 = this.Query(left, b, mid, l, r);
        const p2 = this.Query(right, mid + 1, e, l, r);

        return this._mergeStrategy.Execute(p1, p2);
    }
}

let s;

const bitCount = (n) => {
    n = n - ((n >> 1) & 0x55555555);
    n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
    return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}

function main() {
    while (s = readline()) {
        const q = parseInt(readline());
        const n = s.length;
        const bitwiseOrStrategy = new BitwiseOrStrategy();
        const tree = new SegmentTree(bitwiseOrStrategy, 0, n);
        for (let i = 0; i < n; i++) {
            tree.Update(1, 0, n - 1, i, 1 << (s.charCodeAt(i) - 'a'.charCodeAt(0)));
        }
        for (let i = 0; i < q; i++) {
            const [ty, a, b] = readline().split(' ');
            if (ty == 1) {
                const l = parseInt(a);
                tree.Update(1, 0, n - 1, l - 1, 1 << (b.charCodeAt(0) - 'a'.charCodeAt(0)));
            } else{
                const l = parseInt(a);
                const r = parseInt(b);
                const qr = tree.Query(1, 0, n - 1, l - 1, r - 1);
                console.log(bitCount(qr));
            }
        }
    }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let map = {}, segment = {}

  for(let i = 0; i < 26; i++) {
    map[i]= new Array(n).fill(0)
  }
  // console.log(map[0])

  for(let i = 0; i < n; i++) {
    // console.log(str.charCodeAt(i), str.charCodeAt(i) - 97)
    map[str.charCodeAt(i) - 97][i] = 1
  }

  // console.log(map[0])
  for(let i = 0; i < 26; i++) {
    segment[i] = new SegmentTree(map[i], (a, b) => (a + b), 0)
  }

  // console.log(segment[0])
  for(let i = 0; i < q; i++) {
    // console.log(i)
    const ax = arr[i].split(' ')
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = typeof ax[2] == 'string' ? ax[2] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = str.charCodeAt(pos) - 97
      map[char][pos] = 1
      map[prev][pos] = 0
      str[pos] = r

      segment[char] = new SegmentTree(map[char], (a, b) => (a + b), 0)
      segment[prev] = new SegmentTree(map[prev], (a, b) => (a + b), 0)
    }

    else {
      let count = 0
      // if(i == 3) console.log(segment)
      for(let i = 0; i < 26; i++) {
        if(segment[i].rangeQuery(l - 1, r - 1) > 0) count ++
      }
      console.log(count)
    }
  }
})

class SegmentTree {
  /**
   * @param {number[]} inputArray
   * @param {function} operation - binary function (i.e. sum, min)
   * @param {number} operationFallback - operation fallback value (i.e. 0 for sum, Infinity for min)
   */
  constructor(inputArray, operation, operationFallback) {
    this.inputArray = inputArray;
    this.operation = operation;
    this.operationFallback = operationFallback;

    // Init array representation of segment tree.
    this.segmentTree = this.initSegmentTree(this.inputArray);

    this.buildSegmentTree();
  }

  /**
   * @param {number[]} inputArray
   * @return {number[]}
   */
  initSegmentTree(inputArray) {
    let segmentTreeArrayLength;
    const inputArrayLength = inputArray.length;

    if (isPowerOfTwoBitwise(inputArrayLength)) {
      // If original array length is a power of two.
      segmentTreeArrayLength = (2 * inputArrayLength) - 1;
    } else {
      // If original array length is not a power of two then we need to find
      // next number that is a power of two and use it to calculate
      // tree array size. This is happens because we need to fill empty children
      // in perfect binary tree with nulls.And those nulls need extra space.
      const currentPower = Math.floor(Math.log2(inputArrayLength));
      const nextPower = currentPower + 1;
      const nextPowerOfTwoNumber = 2 ** nextPower;
      segmentTreeArrayLength = (2 * nextPowerOfTwoNumber) - 1;
    }

    return new Array(segmentTreeArrayLength).fill(null);
  }

  /**
   * Build segment tree.
   */
  buildSegmentTree() {
    const leftIndex = 0;
    const rightIndex = this.inputArray.length - 1;
    const position = 0;
    this.buildTreeRecursively(leftIndex, rightIndex, position);
  }

  /**
   * Build segment tree recursively.
   *
   * @param {number} leftInputIndex
   * @param {number} rightInputIndex
   * @param {number} position
   */
  buildTreeRecursively(leftInputIndex, rightInputIndex, position) {
    // If low input index and high input index are equal that would mean
    // the we have finished splitting and we are already came to the leaf
    // of the segment tree. We need to copy this leaf value from input
    // array to segment tree.
    if (leftInputIndex === rightInputIndex) {
      this.segmentTree[position] = this.inputArray[leftInputIndex];
      return;
    }

    // Split input array on two halves and process them recursively.
    const middleIndex = Math.floor((leftInputIndex + rightInputIndex) / 2);
    // Process left half of the input array.
    this.buildTreeRecursively(leftInputIndex, middleIndex, this.getLeftChildIndex(position));
    // Process right half of the input array.
    this.buildTreeRecursively(middleIndex + 1, rightInputIndex, this.getRightChildIndex(position));

    // Once every tree leaf is not empty we're able to build tree bottom up using
    // provided operation function.
    this.segmentTree[position] = this.operation(
      this.segmentTree[this.getLeftChildIndex(position)],
      this.segmentTree[this.getRightChildIndex(position)],
    );
  }

  /**
   * Do range query on segment tree in context of this.operation function.
   *
   * @param {number} queryLeftIndex
   * @param {number} queryRightIndex
   * @return {number}
   */
  rangeQuery(queryLeftIndex, queryRightIndex) {
    const leftIndex = 0;
    const rightIndex = this.inputArray.length - 1;
    const position = 0;

    return this.rangeQueryRecursive(
      queryLeftIndex,
      queryRightIndex,
      leftIndex,
      rightIndex,
      position,
    );
  }

  /**
   * Do range query on segment tree recursively in context of this.operation function.
   *
   * @param {number} queryLeftIndex - left index of the query
   * @param {number} queryRightIndex - right index of the query
   * @param {number} leftIndex - left index of input array segment
   * @param {number} rightIndex - right index of input array segment
   * @param {number} position - root position in binary tree
   * @return {number}
   */
  rangeQueryRecursive(queryLeftIndex, queryRightIndex, leftIndex, rightIndex, position) {
    if (queryLeftIndex <= leftIndex && queryRightIndex >= rightIndex) {
      // Total overlap.
      return this.segmentTree[position];
    }

    if (queryLeftIndex > rightIndex || queryRightIndex < leftIndex) {
      // No overlap.
      return this.operationFallback;
    }

    // Partial overlap.
    const middleIndex = Math.floor((leftIndex + rightIndex) / 2);

    const leftOperationResult = this.rangeQueryRecursive(
      queryLeftIndex,
      queryRightIndex,
      leftIndex,
      middleIndex,
      this.getLeftChildIndex(position),
    );

    const rightOperationResult = this.rangeQueryRecursive(
      queryLeftIndex,
      queryRightIndex,
      middleIndex + 1,
      rightIndex,
      this.getRightChildIndex(position),
    );

    return this.operation(leftOperationResult, rightOperationResult);
  }

  /**
   * Left child index.
   * @param {number} parentIndex
   * @return {number}
   */
  getLeftChildIndex(parentIndex) {
    return (2 * parentIndex) + 1;
  }

  /**
   * Right child index.
   * @param {number} parentIndex
   * @return {number}
   */
  getRightChildIndex(parentIndex) {
    return (2 * parentIndex) + 2;
  }
}

function isPowerOfTwoBitwise(number) {
  // 1 (2^0) is the smallest power of two.
  if (number < 1) {
    return false;
  }

  /*
   * Powers of two in binary look like this:
   * 1: 0001
   * 2: 0010
   * 4: 0100
   * 8: 1000
   *
   * Note that there is always exactly 1 bit set. The only exception is with a signed integer.
   * e.g. An 8-bit signed integer with a value of -128 looks like:
   * 10000000
   *
   * So after checking that the number is greater than zero, we can use a clever little bit
   * hack to test that one and only one bit is set.
   */
  return (number & (number - 1)) === 0;
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  const strArray = str.split('')
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let fenwick = {}
  for(let i = 0; i < 26; i++) {
    fenwick[i] = new FenwickTree(n)
  }
  console.log(fenwick)

  for(let i = 0; i < n; i++) {
    fenwick[strArray[i].charCodeAt() - 97].increase(i + 1, 1)
  }

  for(let i = 0; i < q; i++) {
    const ax = arr[i].split(' ')
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = typeof ax[2] == 'string' ? ax[2] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = strArray[pos].charCodeAt(0) - 97
      if(char != prev){
        strArray[pos] = r
        fenwick[prev].increase(l, -1)
        fenwick[char].increase(l, 1)
      }
    }

    else{
      let count = 0
      for(let i = 0; i < 26; i++) {
        console.log(fenwick[i].queryRange(l,r), i)
        count += fenwick[i].queryRange(l,r) > 0 ? 1 : 0
      }
      console.log(count)
    }
  }
})

class FenwickTree {
  /**
   * Constructor creates empty fenwick tree of size 'arraySize',
   * however, array size is size+1, because index is 1-based.
   *
   * @param  {number} arraySize
   */
  constructor(arraySize) {
    this.arraySize = arraySize;

    // Fill tree array with zeros.
    this.treeArray = Array(this.arraySize + 1).fill(0);
  }

  /**
   * Adds value to existing value at position.
   *
   * @param  {number} position
   * @param  {number} value
   * @return {FenwickTree}
   */
  increase(position, value) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    for (let i = position; i <= this.arraySize; i += (i & -i)) {
      this.treeArray[i] += value;
    }

    return this;
  }

  /**
   * Query sum from index 1 to position.
   *
   * @param  {number} position
   * @return {number}
   */
  query(position) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    let sum = 0;

    for (let i = position; i > 0; i -= (i & -i)) {
      sum += this.treeArray[i];
    }

    return sum;
  }

  /**
   * Query sum from index leftIndex to rightIndex.
   *
   * @param  {number} leftIndex
   * @param  {number} rightIndex
   * @return {number}
   */
  queryRange(leftIndex, rightIndex) {
    if (leftIndex > rightIndex) {
      throw new Error('Left index can not be greater than right one');
    }

    if (leftIndex === 1) {
      return this.query(rightIndex);
    }

    return this.query(rightIndex) - this.query(leftIndex - 1);
  }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  const strArray = str.split('')
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let fenwick = {}
  for(let i = 0; i < 26; i++) {
    fenwick[i] = new FenwickTree(n)
  }

  for(let i = 0; i < n; i++) {
    fenwick[strArray[i].charCodeAt() - 97].increase(i + 1, 1)
  }

  for(let i = 0; i < q; i++) {
    const ax = arr[i].split(' ')
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = typeof ax[2] == 'string' ? ax[2] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = strArray[pos].charCodeAt(0) - 97
      if(char != prev){
        strArray[pos] = r
        fenwick[prev].increase(l, -1)
        fenwick[char].increase(l, 1)
      }
    }

    else{
      let count = 0
      for(let i = 0; i < 26; i++) {
        count += fenwick[i].queryRange(l,r) > 0 ? 1 : 0
      }
      console.log(count)
    }
  }
})

class FenwickTree {
  /**
   * Constructor creates empty fenwick tree of size 'arraySize',
   * however, array size is size+1, because index is 1-based.
   *
   * @param  {number} arraySize
   */
  constructor(arraySize) {
    this.arraySize = arraySize;

    // Fill tree array with zeros.
    this.treeArray = Array(this.arraySize + 1).fill(0);
  }

  /**
   * Adds value to existing value at position.
   *
   * @param  {number} position
   * @param  {number} value
   * @return {FenwickTree}
   */
  increase(position, value) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    for (let i = position; i <= this.arraySize; i += (i & -i)) {
      this.treeArray[i] += value;
    }

    return this;
  }

  /**
   * Query sum from index 1 to position.
   *
   * @param  {number} position
   * @return {number}
   */
  query(position) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    let sum = 0;

    for (let i = position; i > 0; i -= (i & -i)) {
      sum += this.treeArray[i];
    }

    return sum;
  }

  /**
   * Query sum from index leftIndex to rightIndex.
   *
   * @param  {number} leftIndex
   * @param  {number} rightIndex
   * @return {number}
   */
  queryRange(leftIndex, rightIndex) {
    if (leftIndex > rightIndex) {
      throw new Error('Left index can not be greater than right one');
    }

    if (leftIndex === 1) {
      return this.query(rightIndex);
    }

    return this.query(rightIndex) - this.query(leftIndex - 1);
  }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  const strArray = str.split('')
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let fenwick = {}
  for(let i = 0; i < 26; i++) {
    fenwick[i] = new FenwickTree(n)
  }
  // console.log(fenwick)

  for(let i = 0; i < n; i++) {
    fenwick[strArray[i].charCodeAt() - 97].increase(i + 1, 1)
  }

  for(let i = 0; i < q; i++) {
    const ax = arr[i].split(' ')
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = typeof ax[2] == 'string' ? ax[2] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = strArray[pos].charCodeAt(0) - 97
      if(char != prev){
        strArray[pos] = r
        fenwick[prev].increase(l, -1)
        fenwick[char].increase(l, 1)
      }
    }

    else{
      let count = 0
      for(let i = 0; i < 26; i++) {
        console.log(fenwick[i], fenwick[i].queryRange(l,r))
        console.log(l, r, fenwick[i].queryRange(l,r), i)
        count += fenwick[i].queryRange(l,r) > 0 ? 1 : 0
      }
      console.log(count)
    }
  }
})

class FenwickTree {
  /**
   * Constructor creates empty fenwick tree of size 'arraySize',
   * however, array size is size+1, because index is 1-based.
   *
   * @param  {number} arraySize
   */
  constructor(arraySize) {
    this.arraySize = arraySize;

    // Fill tree array with zeros.
    this.treeArray = Array(this.arraySize + 1).fill(0);
  }

  /**
   * Adds value to existing value at position.
   *
   * @param  {number} position
   * @param  {number} value
   * @return {FenwickTree}
   */
  increase(position, value) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    for (let i = position; i <= this.arraySize; i += (i & -i)) {
      this.treeArray[i] += value;
    }

    return this;
  }

  /**
   * Query sum from index 1 to position.
   *
   * @param  {number} position
   * @return {number}
   */
  query(position) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    let sum = 0;

    for (let i = position; i > 0; i -= (i & -i)) {
      sum += this.treeArray[i];
    }

    return sum;
  }

  /**
   * Query sum from index leftIndex to rightIndex.
   *
   * @param  {number} leftIndex
   * @param  {number} rightIndex
   * @return {number}
   */
  queryRange(leftIndex, rightIndex) {
    if (leftIndex > rightIndex) {
      throw new Error('Left index can not be greater than right one');
    }

    if (leftIndex === 1) {
      return this.query(rightIndex);
    }

    return this.query(rightIndex) - this.query(leftIndex - 1);
  }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  const strArray = str.split('')
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let fenwick = {}
  for(let i = 0; i < 26; i++) {
    fenwick[i] = new FenwickTree(n)
  }
  // console.log(fenwick)

  for(let i = 0; i < n; i++) {
    fenwick[strArray[i].charCodeAt() - 97].increase(i + 1, 1)
  }

  for(let i = 0; i < q; i++) {
    const ax = arr[i].split(' ')
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = typeof ax[2] == 'string' ? ax[2] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = strArray[pos].charCodeAt(0) - 97
      if(char != prev){
        strArray[pos] = r
        fenwick[prev].increase(l, -1)
        fenwick[char].increase(l, 1)
      }
    }

    else{
      let count = 0
      for(let i = 0; i < 26; i++) {
        console.log(fenwick[i], fenwick[i].queryRange)
        console.log(fenwick[i].queryRange(l,r), i)
        count += fenwick[i].queryRange(l,r) > 0 ? 1 : 0
      }
      console.log(count)
    }
  }
})

class FenwickTree {
  /**
   * Constructor creates empty fenwick tree of size 'arraySize',
   * however, array size is size+1, because index is 1-based.
   *
   * @param  {number} arraySize
   */
  constructor(arraySize) {
    this.arraySize = arraySize;

    // Fill tree array with zeros.
    this.treeArray = Array(this.arraySize + 1).fill(0);
  }

  /**
   * Adds value to existing value at position.
   *
   * @param  {number} position
   * @param  {number} value
   * @return {FenwickTree}
   */
  increase(position, value) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    for (let i = position; i <= this.arraySize; i += (i & -i)) {
      this.treeArray[i] += value;
    }

    return this;
  }

  /**
   * Query sum from index 1 to position.
   *
   * @param  {number} position
   * @return {number}
   */
  query(position) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    let sum = 0;

    for (let i = position; i > 0; i -= (i & -i)) {
      sum += this.treeArray[i];
    }

    return sum;
  }

  /**
   * Query sum from index leftIndex to rightIndex.
   *
   * @param  {number} leftIndex
   * @param  {number} rightIndex
   * @return {number}
   */
  queryRange(leftIndex, rightIndex) {
    if (leftIndex > rightIndex) {
      throw new Error('Left index can not be greater than right one');
    }

    if (leftIndex === 1) {
      return this.query(rightIndex);
    }

    return this.query(rightIndex) - this.query(leftIndex - 1);
  }
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const str = arr.shift()
  const strArray = str.split('')
  let n = str.length
  const q = parseInt(arr.shift())
  if(str.charCodeAt(n - 1) == 13) n--

  let fenwick = {}
  for(let i = 0; i < 26; i++) {
    fenwick[i] = new FenwickTree(n)
  }

  for(let i = 0; i < n; i++) {
    fenwick[strArray[i].charCodeAt() - 97].increase(i + 1, 1)
  }

  for(let i = 0; i < q; i++) {
    const ax = arr[i].split(' ')
    const qT = parseInt(ax[0])
    const l = parseInt(ax[1])
    const r = typeof ax[2] == 'string' ? ax[2] : parseInt(ax[2])

    if(qT == 1) {
      const pos = l - 1
      const char = r.charCodeAt(0) - 97
      const prev = strArray[pos].charCodeAt(0) - 97
      if(char != prev){
        strArray[pos] = r
        fenwick[prev].increase(l, -1)
        fenwick[char].increase(l, 1)
      }
    }

    else{
      let count = 0
      for(let i = 0; i < 26; i++) {
        console.log(fenwick[i].queryRange(l,r), i)
        count += fenwick[i].queryRange(l,r) > 0 ? 1 : 0
      }
      console.log(count)
    }
  }
})

class FenwickTree {
  /**
   * Constructor creates empty fenwick tree of size 'arraySize',
   * however, array size is size+1, because index is 1-based.
   *
   * @param  {number} arraySize
   */
  constructor(arraySize) {
    this.arraySize = arraySize;

    // Fill tree array with zeros.
    this.treeArray = Array(this.arraySize + 1).fill(0);
  }

  /**
   * Adds value to existing value at position.
   *
   * @param  {number} position
   * @param  {number} value
   * @return {FenwickTree}
   */
  increase(position, value) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    for (let i = position; i <= this.arraySize; i += (i & -i)) {
      this.treeArray[i] += value;
    }

    return this;
  }

  /**
   * Query sum from index 1 to position.
   *
   * @param  {number} position
   * @return {number}
   */
  query(position) {
    if (position < 1 || position > this.arraySize) {
      throw new Error('Position is out of allowed range');
    }

    let sum = 0;

    for (let i = position; i > 0; i -= (i & -i)) {
      sum += this.treeArray[i];
    }

    return sum;
  }

  /**
   * Query sum from index leftIndex to rightIndex.
   *
   * @param  {number} leftIndex
   * @param  {number} rightIndex
   * @return {number}
   */
  queryRange(leftIndex, rightIndex) {
    if (leftIndex > rightIndex) {
      throw new Error('Left index can not be greater than right one');
    }

    if (leftIndex === 1) {
      return this.query(rightIndex);
    }

    return this.query(rightIndex) - this.query(leftIndex - 1);
  }
}

'use strict'

const s = readline().split('');
const n = s.length;
const take = [].reduce.call('abcdefghijklmnopqrstuvwxyz', (r, i, j) => { r[i] = j; return r; }, {});
const bit = Array.from({ length: 26 }, () => Array(n).fill(0))

const upd = (b, i, v) => {
    while (i <= n) { b[i] += v; i += i&-i; }
}

const query = (b, i) => {
  let r = 0;
  while (i) { r += b[i]; i -= i&-i; }
  return r;
}

for (let i = 0; i < n; i++) {
    upd(bit[take[s[i]]], i + 1, 1);
}

let q = parseInt(readline());
while(q--) {
    const t = readline().split(' ');
    if (t[0] === '1') {
        const j = parseInt(t[1]) - 1;
        upd(bit[take[s[j]]], j + 1, -1);
        upd(bit[take[t[2]]], j + 1, 1);
        s[j] = t[2];
    } else {
        const l = parseInt(t[1]) - 1;
        const r = parseInt(t[2]);
        write(bit.filter(i => query(i, r) > query(i, l)).length + '\n');
    }
}

'use strict'

const p = [].reduce.call('abcdefghijklmnopqrstuvwxyz', (r, i) => { r[i] = []; return r; }, {});
const s = readline().split('');
s.forEach((i, j) => p[i][j] = true);

const q = parseInt(readline());

for (let i = 0; i < q; i++) {
    const t = readline().split(' ');
    if (t[0] === '1') {
        const j = parseInt(t[1]) - 1;
        p[s[j]][j] = false;
        s[j] = t[2];
        p[s[j]][j] = true;
    }
    else {
		const l = parseInt(t[1]) - 1;
        const r = parseInt(t[2]);
        let res = 0;
        Object.keys(p).forEach(k => {
            let j = l;
            while(j < r && !p[k][j]) j++;
            if (p[k][j]) res++;
        })

        write(res + '\n');
    }
}


"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if ((i + 1) < (ind+1)) str[i] = c;
          else if (((i + 1) % (ind+1)) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
  }
};
solve();

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var c = next();
		var s = next();
		var count = 0;
		var output = [];
		var set = new Set();
		for(var i = 0; i < N; i++){
			if(s[i] != c){
				set.add(i + 1);
			}
		}
		if(set.size == 0){
			myout(0);
			continue;
		}
		for(var i = 2; i <= N; i++){
			var isOK = true;
			for(var j = 1; i * j <= N; j++){
				if(set.has(i * j)){
					isOK = false;
					break;
				}
			}
			if(isOK){
				count = 1;
				output.push(i);
				break;
			}
		}
		if(count > 0){
			myout(count);
			myout(myconv(output, 8));
			continue;
		}
		output.push(N);
		output.push(N - 1);
		myout(2);
		myout(myconv(output, 8));
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const readLine = () => dataitr.next().value.trim();
function rl () {
	let ans = readLine().split(' ');
	if (!isNaN(Number(ans[0]))) ans = ans.map(x => Number(x));
	return ans.length == 1 ? ans[0] : ans;
}
const rla = () => readLine().split(' ').map(x => Number(x));

function main () {
	let t = rl();
	while (t--) {
		let [n, c] = readLine().split(' ');
		n = Number(n);
		let s = rl();

		let ans = [n - 1, n], same = true;
		for (each of s) same &= each == c;
		if (same) ans = [];

		for (let i = 2; !same && i <= n; i++) {
			let ok = true;
			for (x = i; ok && x <= n; x += i) {
				if (s[x-1] != c) ok = false;
			}
			if (ok) { ans = [i]; break; }
		}

		console.log(ans.length);
		if (ans.length) console.log(ans.join(' '));
	}
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    let t=Number(readline())
    for(let i=0;i<t;i++)
    {
        let [n,c]=readline().split(' ')
        let s=readline()
        let b=1;
        for(let i=0;i<n;i++)
            b&=(s[i]==c)
        if(b)
        {
            console.log(0)
            continue
        }
        s='3'+s;
        for(let i=1;i<=n;i++)
        {
            let here=1;
            for(let j=i;j<=n;j+=i)
                here&=(s[j]==c);
            if(here)
            {
                console.log(`1\n${i}`)
                b=1;
                break;
            }
        }
        if(!b)
            console.log(`2\n${n} ${n-1}`)
    }
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
const FLAGS = primes(3e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }
    return flag

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, ch] = lines[l++].trim().split(' ')
        const str = lines[l++].split('')
        console.log(solve(n, ch, str))
    }
// })()
})

function solve(n, ch, str) {
    // if (n === 1) return str[0] === ch ? 0 : `1\n`
    n = +n
    let found = false
    for (let i = 1; i <= str.length; i++) {
        if (str[i - 1] !== ch) {
            found = true
        }
    }
    if (!found) return 0

    for (let i = Math.ceil((n + 1) / 2); i <= str.length; i++) {
        if (str[i - 1] === ch) return `1\n${i}`
    }
    return `2\n${n - 1} ${n}`

    // let i = n
    // while (!FLAGS[i]) i--

    // if (str[i - 1] === ch) {
    //     return not.length ? `1\n${i}` : '0'
    // } else {
    //     let j = i - 1
    //     while (!FLAGS[j]) j--
    //     return not.length === 1 ? `1\n${j}` : `2\n${i} ${j}`
    // }

    // const FLAGS = []
    // let has = false
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] !== ch && FLAGS[i]) {
    //         has = true
    //     }
    // }

    // return [n, ch, str]
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data * 2
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        main()
        process.exit(0)
    }
})

function cZ(ctr, ltr) {
    for (let i = 0; i < ctr.length; ++i) {
        if (ctr[i] !== ltr) return false
    }
    console.log('0')
    return true
}

function cO(siz, str, ltr) {
    let isF;
    for (let i = 2; i <= siz; ++i) {
        isF = true;
        for (let j = i - 1; j < siz; j += i) {
            if (str[j] !== ltr) {
                isF = false;
            }
        }
        if (isF) {
            console.log(1)
            console.log(i)
            return true;
        }
    }
    return false;
}

function solve([num, ltr], str) {
    if (cZ(str, ltr)) return;
    if (!cO(num, str, ltr)) {
        console.log(2)
        console.log(`${num - 1} ${num}`)
    }
}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) solve(inputArr[i].split(' '), inputArr[i + 1])
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if (i + 1 < ind) str[i] = c;
          else if (i + (1 % ind) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if (i + 1 < ind) str[i] = c;
          else if (i + (1 % ind) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind - 1; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 2; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if (i + 1 < ind) str[i] = c;
          else if (i + (1 % ind) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind - 1; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 2; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if (i + 1 < ind) str[i] = c;
          else if (i + (1 % ind) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind - 1; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
    console.log(str);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    console.log(c);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 2; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if (i + 1 < ind) str[i] = c;
          else if (i + (1 % ind) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind - 1; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    console.log(c);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 2; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans === true) {
      console.log(0);
      continue;
    }
    let ind = -1;
    for (let i = n - 1; i >= 0; i--) {
      if (str[i] === c) {
        ind = i;
        break;
      }
    }
    if (ind === -1 || ind === 0) {
      console.log(2);
      console.log(n + " " + (n - 1));
    } else if (ind === n - 1 || ind === n - 2) {
      console.log(1);
      console.log(ind + 1);
    } else {
      let res = [];
      while (true) {
        res.push(ind + 1);
        for (let i = 0; i < n; i++) {
          if (i + 1 < ind) str[i] = c;
          else if (i + (1 % ind) != 0) str[i] = c;
        }
        let flag = true;
        for (let i = ind - 1; i < n; i++) {
          if (str[i] !== c) {
            flag = false;
            break;
          }
        }
        if (flag) {
          console.log(res.length);
          console.log(res.join(" "));
          break;
        }
        for (let i = n - 1; i >= 0; i--) {
          if (str[i] === c) {
            ind = i;
            break;
          }
        }
      }
    }
    console.log(str);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    n = parseInt(n);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 2; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans) {
      if (str[n - 1] === c && str[n - 2] === c) console.log(0);
      else if (str[n - 1] === c) {
        console.log(1);
        console.log(n);
      } else if (str[n - 2] === c) {
        console.log(1);
        console.log(n - 1);
      } else {
        console.log(2);
        console.log(n + " " + (n - 1));
      }
    } else {
      if (str[n - 1] === c) {
        console.log(1);
        console.log(n);
      } else if (str[n - 2] === c) {
        console.log(1);
        console.log(n - 1);
      } else {
        console.log(2);
        console.log(n + " " + (n - 1));
      }
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    n = parseInt(n);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 2; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (ans) {
      if (str[n - 1] === c && str[n - 2] === c) console.log(0);
      else if (str[n - 1] === c) {
        console.log(1);
        console.log(n);
      } else {
        console.log(1);
        console.log(n - 1);
      }
    } else {
      if (str[n - 1] === c) {
        console.log(1);
        console.log(n);
      } else if (str[n - 2] === c) {
        console.log(1);
        console.log(n - 1);
      } else {
        console.log(2);
        console.log(n + " " + (n - 1));
      }
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    n = parseInt(n);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 1; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (str[n - 1] === c && ans) console.log(0);
    else if (ans && str[n - 1] !== c) {
      console.log(1);
      console.log(n - 1);
    } else if (str[n - 1] === c) {
      console.log(1);
      console.log(n);
    } else if (str[n - 2] === c) {
      console.log(1);
      console.log(n - 1);
    } else {
      console.log(2);
      console.log(n - 1 + " " + n);
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    n = parseInt(n);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 1; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (str[n - 1] === c && ans) console.log(0);
    else if (ans && str[n - 1] !== c) {
      console.log(1);
      console.log(n - 1);
    } else if (str[n - 1] === c) {
      console.log(1);
      console.log(n - 1);
    } else if (str[n - 2] === c) {
      console.log(1);
      console.log(n);
    } else {
      console.log(2);
      console.log(n - 1 + " " + n);
    }
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let [n, c] = readline().trim().split(" ");
    n = parseInt(n);
    let str = readline().trim().split("");
    let ans = true;
    for (let i = 0; i < n - 1; i++) {
      if (str[i] !== c) {
        ans = false;
        break;
      }
    }
    if (str[n - 1] === c && ans) console.log(0);
    else if (ans && str[n - 1] !== c) {
      console.log(1);
      console.log(n - 1);
    } else if (str[n - 1] === c) {
      console.log(1);
      console.log(n - 1);
    } else {
      console.log(2);
      console.log(n - 1 + " " + n);
    }
  }
};
solve();

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
const FLAGS = primes(3e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }
    return flag

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, ch] = lines[l++].trim().split(' ')
        const str = lines[l++].split('')
        console.log(solve(n, ch, str))
    }
// })()
})

function solve(n, ch, str) {
    // if (n === 1) return str[0] === ch ? 0 : `1\n`
    n = +n
    let found = false
    for (let i = 1; i <= str.length; i++) {
        if (str[i - 1] !== ch) {
            found = true
        }
    }
    if (!found) return 0

    for (let i = Math.ceil(n / 2); i <= str.length; i++) {
        if (str[i - 1] === ch) return `1\n${i}`
    }
    return `2\n${n - 1} ${n}`

    // let i = n
    // while (!FLAGS[i]) i--

    // if (str[i - 1] === ch) {
    //     return not.length ? `1\n${i}` : '0'
    // } else {
    //     let j = i - 1
    //     while (!FLAGS[j]) j--
    //     return not.length === 1 ? `1\n${j}` : `2\n${i} ${j}`
    // }

    // const FLAGS = []
    // let has = false
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] !== ch && FLAGS[i]) {
    //         has = true
    //     }
    // }

    // return [n, ch, str]
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
const FLAGS = primes(3e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }
    return flag

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, ch] = lines[l++].trim().split(' ')
        const str = lines[l++].split('')
        console.log(solve(n, ch, str))
    }
// })()
})

function solve(n, ch, str) {
    // if (n === 1) return str[0] === ch ? 0 : `1\n`
    n = +n
    let found = false
    for (let i = 1; i <= str.length; i++) {
        if (str[i - 1] === ch) {
            if (i >= Math.ceil(n / 2)) return `1\n${i}`
        } else {
            found = true
        }
    }
    return found ? `2\n${n - 1} ${n}` : 0

    // let i = n
    // while (!FLAGS[i]) i--

    // if (str[i - 1] === ch) {
    //     return not.length ? `1\n${i}` : '0'
    // } else {
    //     let j = i - 1
    //     while (!FLAGS[j]) j--
    //     return not.length === 1 ? `1\n${j}` : `2\n${i} ${j}`
    // }

    // const FLAGS = []
    // let has = false
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] !== ch && FLAGS[i]) {
    //         has = true
    //     }
    // }

    // return [n, ch, str]
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
const FLAGS = primes(3e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }
    return flag

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, ch] = lines[l++].trim().split(' ')
        const str = lines[l++].split('')
        console.log(solve(n, ch, str))
    }
// })()
})

function solve(n, ch, str) {
    // if (n === 1) return str[0] === ch ? 0 : `1\n`
    n = +n
    const not = []
    for (let i = 0; i < str.length; i++) {
        if (str[i] !== ch) not.push(i)
    }
    if (not.length === 1 && str[n - 1] === ch) return `1\n${n}`

    let i = n
    while (!FLAGS[i]) i--

    if (str[i - 1] === ch) {
        return not.length ? `1\n${i}` : '0'
    } else {
        let j = i - 1
        while (!FLAGS[j]) j--
        return not.length === 1 ? `1\n${j}` : `2\n${i} ${j}`
    }

    // const FLAGS = []
    // let has = false
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] !== ch && FLAGS[i]) {
    //         has = true
    //     }
    // }

    // return [n, ch, str]
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
const FLAGS = primes(3e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }
    return flag

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, ch] = lines[l++].trim().split(' ')
        const str = lines[l++].split('')
        console.log(solve(n, ch, str))
    }
// })()
})

function solve(n, ch, str) {
    // if (n === 1) return str[0] === ch ? 0 : `1\n`
    n = +n
    const not = []
    for (let i = 0; i < str.length; i++) {
        if (str[i] !== ch) not.push(i)
    }

    let i = n
    while (!FLAGS[i]) i--

    if (str[i - 1] === ch) {
        return not.length ? `1\n${i}` : '0'
    } else {
        let j = i - 1
        while (!FLAGS[j]) j--
        return not.length === 1 ? `1\n${j}` : `2\n${i} ${j}`
    }

    // const FLAGS = []
    // let has = false
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] !== ch && FLAGS[i]) {
    //         has = true
    //     }
    // }

    // return [n, ch, str]
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
const FLAGS = primes(3e5)
function primes(n) {
    const flag = Array(n + 1).fill(true)
    flag[0] = false
    flag[1] = false

    const limit = Math.floor(Math.sqrt(n))
    for (let i = 2; i <= limit; i++) {
        for (let j = i * i; j <= n; j += i) {
            flag[j] = false
        }
    }
    return flag

    const ps = []
    for (let i = 2; i <= n; i++) {
        if (flag[i]) ps.push(i)
    }
    return ps
}
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    for (let i = 0; i < t; i++) {
        const [n, ch] = lines[l++].trim().split(' ')
        const str = lines[l++].split('')
        console.log(solve(n, ch, str))
    }
// })()
})

function solve(n, ch, str) {
    // if (n === 1) return str[0] === ch ? 0 : `1\n`
    n = +n
    const not = []
    for (let i = 0; i < str.length; i++) {
        if (str[i] !== ch) not.push(i)
    }

    let i = n
    while (!FLAGS[i]) i--

    if (str[i] === ch) {
        return not.length ? `1\n${i}` : '0'
    } else {
        let j = i - 1
        while (!FLAGS[j]) j--
        return `2\n${i} ${j}`
    }

    // const FLAGS = []
    // let has = false
    // for (let i = 0; i < str.length; i++) {
    //     if (str[i] !== ch && FLAGS[i]) {
    //         has = true
    //     }
    // }

    // return [n, ch, str]
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data * 2
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        main()
        process.exit(0)
    }
})

function cZ(ctr, ltr) {
    for (let i = 0; i < ctr.length; ++i) {
        if (ctr[i] !== ltr) return false
    }
    console.log('0')
    return true
}

function cO(siz, str, ltr) {
    let isF;
    for (let i = 2; i <= siz; ++i) {
        isF = true;
        for (let j = i - 1; j < siz; j += i) {
            if (str[j] !== ltr) {
                isF = false;
            }
        }
        if (isF) {
            console.log(1)
            console.log(i)
            return true;
        }
    }
    return false;
}

function solve([num, ltr], str) {
    if (cZ(str, ltr)) return;
    if (!cO(num, str, ltr)) {
        console.log(2)
        console.log(num + '' + num - 1)
    }
}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) solve(inputArr[i].split(' '), inputArr[i + 1])
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data * 2
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        main()
        process.exit(0)
    }
})

const sm = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
    107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]

function isSmp(num) {
    if (num === 1) return false
    let flag = true;
    for (let i = 2; i < num; i++) {
        if (num % i === 0 && i !== 1) {
            flag = false;
            break
        }
    }
    return flag
}

function solve([num, letr], str) {
    let res = []
    let needTwo = false
    for (let i = 0; i < num; i++) {
        if ((i + 1) % 2 === 0) {
            if (str[i] !== letr) {
                res.push(i)
            }
        } else {
            if (!needTwo && str[i] !== letr) {
                needTwo = true;
            }
        }
    }
    if (needTwo) {
        res.unshift(2)
    }
    res = res.filter(i => isSmp(i))
    console.log(res.length)
    if (res.length) {
        console.log(res.join(' '))
    }
}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) solve(inputArr[i].split(' '), inputArr[i + 1])
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data * 2
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        main()
        process.exit(0)
    }
})

const sm = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
    107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]

function isSmp(num) {
    let flag = true;
    for (let i = 2; i < num; i++) {
        if (num % i === 0) {
            flag = false;
            break
        }
    }
    return flag
}

function solve([num, letr], str) {
    let res = []
    let needTwo = false
    for (let i = 0; i < num; i++) {
        if ((i + 1) % 2 === 0) {
            if (str[i] !== letr) {
                res.push(i)
            }
        } else {
            if (!needTwo && str[i] !== letr) {
                needTwo = true;
            }
        }
    }
    if (needTwo) {
        res.unshift(2)
    }
    res = res.filter(i => isSmp(i + 1))
    console.log(res.length)
    if (res.length) {
        console.log(res.join(' '))
    }
}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) solve(inputArr[i].split(' '), inputArr[i + 1])
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data * 2
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        main()
        process.exit(0)
    }
})

const sm = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
    107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]

function isSmp(num) {
    let flag = true;
    for (let i = 2; i < num; i++) {
        if (num % i === 0) {
            flag = false;
            break
        }
    }
    return flag
}

function solve([num, letr], str) {
    let res = []
    let needTwo = false
    for (let i = 0; i < num; i++) {
        if ((i + 1) % 2 === 0) {
            if (str[i] !== letr) {
                res.push(i)
            }
        } else {
            if (!needTwo && str[i] !== letr) {
                needTwo = true;
            }
        }
    }
    if (needTwo) {
        res.unshift(2)
    }
    res = res.filter(i => isSmp(i))
    console.log(res.length)
    if (res.length) {
        console.log(res.join(' '))
    }
}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) solve(inputArr[i].split(' '), inputArr[i + 1])
}

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data * 2
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        main()
        process.exit(0)
    }
})

const sm = [2,3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,
    107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199]

function solve([num, letr], str) {
    let res = []
    let needTwo = false
    for (let i = 0; i < num; i++) {
        if ((i + 1) % 2 === 0) {
            if (str[i] !== letr) {
                res.push(i)
            }
        } else {
            if (!needTwo && str[i] !== letr) {
                needTwo = true;
            }
        }
    }
    if (needTwo) {
        res.unshift(2)
    }
    res = res.filter(i => sm.includes(i))
    console.log(res.length)
    if(res.length){
        console.log(res.join(' '))
    }

}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) solve(inputArr[i].split(' '), inputArr[i + 1])
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var c = next();
		var s = next();
		var isOK = [false, false];
		for(var i = 0; i < N - 1; i++){
			if(s[i] != c){
				isOK[0] = true;
				break;
			}
		}
		if(s[N - 1] != c){
			isOK[1] = true;
		}
		var count = (isOK[0] ? 1 : 0) + (isOK[1] ? 1 : 0);
		var output = [];
		if(isOK[0]){
			output.push(N);
		}
		if(isOK[1]){
			output.push(N - 1);
		}
		myout(count);
		if(output.length > 0){
			myout(myconv(output, 8));
		}
	}
}