"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 = 1;
  while (t--) {
    let [n, k, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    n = Number(n);
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    arr.sort((a, b) => {
      if (a <= b) return -1;
      else return 1;
    });
    let dif = [],
      cnt = 1;
    for (let i = 0; i < n - 1; i++) {
      if (arr[i + 1] - arr[i] > x) {
        dif.push(arr[i + 1] - arr[i]);
        cnt++;
      }
    }
    if (dif.length) {
      dif.sort((a, b) => {
        if (a <= b) return -1;
        else return 1;
      });
      for (let i = 0; i < dif.length; i++) {
        let j = dif[i] % x === 0n ? dif[i] / x - 1n : dif[i] / x;
        if (j > k) break;
        else {
          cnt--;
          k -= j;
        }
      }
      console.log(cnt);
    } else console.log(cnt);
  }
};
solve();

// --------------- PRE-DEFINED START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};

const nextBigIntArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => BigInt(num));
};

function sortAsc(a, b) {
   if (a < b) return -1;
   if (a > b) return 1;
   return 0;
}
// --------------- PRE-DEFINED END ---------------

const main = async () => {
  let [n, k, x] = await nextBigIntArr();
  let arr = await nextBigIntArr();

  let gaps = [];

  arr.sort(sortAsc);
  for (let i = 1; i < n; i++) {
    const tmp = arr[i] - arr[i-1];
    if (tmp > x) gaps.push((tmp / x) - (tmp % x === 0n ? 1n : 0n));
  }

  gaps.sort(sortAsc);
  let res = gaps.length + 1;
  for (let i = 0; i < gaps.length; i++) {
    if (gaps[i] > k) break;
    k -= gaps[i];
    res -= 1;
  }

  console.log(res);
};

main();

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

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => ((await getLineGen.next()).value);
})();

let solve = async () => {
    let strn, strk, strx;
    let n, k, x;
    [n, k, x] = (await getLine()).split(' ').map(num => parseInt(num));
    const a = (await getLine()).split(' ').map(num => parseInt(num));
    let bigcmp = function(a,b) {
        const zero = BigInt(0);
        const diff = a-b;
        if (diff < zero)
            return -1;
        else if (diff > zero)
            return 1;
        else return 0;
    }
    a.sort((a,b) => (a-b));
    const diffs = [];
    for(let i = 1; i < n; i++) {
       if (a[i] - a[i-1] > x) {
           diffs.push(a[i]-a[i-1]);
       }
    }
    diffs.sort((a,b)=>(a-b));
    let i;
    for(i = 0; i<diffs.length && k > 0; i++) {
        let need = Math.floor((diffs[i] - 1) / x);
       if (need > k)
           break;
       else
           k -= need;
    }
    console.log(diffs.length - i + 1);
}

solve();

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    var [n, k, x] = lines[l++].split(' ').map(BigInt);
    var arr = lines[l++].split(' ').map(BigInt);
    console.log(solve(n, k, x, arr))
});

function solve(n, k, x, arr) {
    const cp = (a, b) => {
        if (a < b) {
            return -1
        } else if (a > b) {
            return 1
        } else {
            return 0
        }
    }
    arr.sort(cp)

    const needs = []
    arr.forEach((item, i) => {
        if (i && item - arr[i - 1] > x) {
            const need = ceil((item - arr[i - 1]), x) - 1n
            needs.push(need)
        }
    })
    needs.sort(cp)

    let sum = 0n
    for (let i = 0; i < needs.length; i++) {
        if (sum + needs[i] > k) {
            return needs.length - i + 1
        }
        sum += needs[i]
    }
    return 1
}

function ceil(a, b) {
    const r = a % b
    return r ? (a - r) / b + 1n : a / b
}

function gcd(x, y) {
   if (y === 0) {
      return x;
   }
   return gcd(y, x % y);
}

function div(a, b) {
   return Math.floor(a / b);
}

function solve() {
   var nkx = readArray(BigInt);
   var n = Number(nkx[0]);
   var k = nkx[1];
   var x = nkx[2];
   var a = readArray(BigInt);
   a.sort(sortF);
   var ans = 1;
   var arr = [];
   for (var i = 1; i < n; i++) {
      var diff = a[i] - a[i - 1];
      if (diff > x) {
         ans++;
         arr.push((diff / x) - (diff % x === 0n ? 1n : 0n));
      }
   }
   arr.sort(sortF);
   for (var i = 0; i < arr.length; i++) {
      if (arr[i] > k) {
         break;
      }
      k -= arr[i];
      ans--;
   }
   write(ans);
}

function init() {
   var T;
   T = 1;
   //T = Number(read());
   for (var t = 0; t < T; t++) {
      solve();
   }
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
// import * as readline from 'readline'
// const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
// const ask = (query: string) => new Promise<string>((resolve) => rl.question(query, resolve))
// // Don't forget `rl.close()`.
const INT = Math.floor;
Array.prototype.last = function () {
    return this.length === 0 ? undefined : this[this.length - 1];
};
Array.prototype.isEmpty = function () {
    return this.length === 0;
};
const less = (a, b) => (a == b ? 0 : a < b ? -1 : 1);
const greater = (a, b) => (a == b ? 0 : a < b ? 1 : -1);
const bigIntMax = (...args) => args.reduce((m, e) => (e > m ? e : m));
const bigIntMin = (...args) => args.reduce((m, e) => (e < m ? e : m));
const bigIntAbs = (arg) => (arg < 0 ? -arg : arg);
function read_stdin() {
    return fs.readFileSync(process.env.NODE_ENV === 'debug' ? stdin : process.stdin.fd, 'utf8');
}
class Input {
    constructor(str) {
        this.index = 0;
        this.inputs = (str ? str : read_stdin()).split(/\s+/);
    }
    number() {
        return Number(this.inputs[this.index++]);
    }
    numbers(n) {
        return this.inputs.slice(this.index, (this.index += n)).map(Number);
    }
    bigint() {
        return BigInt(this.inputs[this.index++]);
    }
    bigints(n) {
        return this.inputs.slice(this.index, (this.index += n)).map(BigInt);
    }
    word() {
        return this.inputs[this.index++];
    }
    words(n) {
        return this.inputs.slice(this.index, (this.index += n));
    }
}
function array(len, init) {
    return Array(len).fill(init);
}
function array2(h, w, init) {
    return array(h, 0).map(() => array(w, init));
}
function main() {
    const input = new Input();
    const N = input.number();
    const K = input.bigint();
    const X = input.bigint();
    const A = input.bigints(N);
    A.sort(less);
    let count = 1;
    const spans = [];
    for (let i = 1; i < N; i++) {
        if (A[i] - A[i - 1] > X) {
            count++;
            spans.push((A[i] - 1n - A[i - 1]) / X);
        }
    }
    spans.sort(less);
    let k = K;
    for (let i = 0; i < spans.length; i++) {
        if (k === 0n)
            break;
        const span = spans[i];
        if (span > k)
            break;
        count--;
        k -= span;
    }
    console.log(count);
}
main();
//# sourceMappingURL=aoj.js.map

nkx = readline().split(' ');
n = +nkx[0];
k = +nkx[1];
x = +nkx[2];

a = readline().split(' ').map(x => +x);
a.sort((o, p) => o - p);

gF = [];
gL = [];

lastF = a[0];
lastL = a[0];

for (i = 1; i < n; ++i) {
  if (a[i] - a[i - 1] <= x) {
    lastL = a[i];
  } else {
    gF.push(lastF);
    gL.push(lastL);

    lastF = a[i];
    lastL = a[i];
  }
}

gF.push(lastF);
gL.push(lastL);

distances = [];

for (i = 1; i < gF.length; ++i) {
  distances.push(gF[i] - gL[i - 1]);
}

distances.sort((o, p) => o - p);

res = gF.length;

for (i = 0; i < distances.length; ++i) {
  dist = Math.ceil(distances[i] / x) - 1;

  if (dist <= k) {
    k -= dist;
    res -= 1;
  }
}

print(res);

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 rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => BigInt(x));

function main () {
	let [n, k, x] = rna();
	n = Number(n);
	const a = rna();

	//a.sort((x, y) => x - y);
	a.sort((a ,b) => {
			if(a > b) {
			return 1;
			} else if (a < b){
			return -1;
			} else {
			return 0;
			}
			});

	const d = [];
	for (let i = 0; i < n - 1; i++) {
		if (a[i+1] - a[i] > x) {
			d.push(a[i+1] - a[i]);
		}
	}

	d.sort((a ,b) => {
			if(a > b) {
			return 1;
			} else if (a < b){
			return -1;
			} else {
			return 0;
			}
			});

	let ans = d.length + 1;
	for (const df of d) {
		k -= (df-1n)/x;
		if (k >= 0) ans--;
	}

	console.log(ans);
}

"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 = 1;
  while (t--) {
    let [n, k, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    n = Number(n);
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    arr.sort((a, b) => {
      if (a <= b) return -1;
      else return 1;
    });
    let dif = [],
      cnt = 1;
    for (let i = 0; i < n - 1; i++) {
      if (arr[i + 1] - arr[i] > x) {
        let j = arr[i + 1] - arr[i];
        if (j <= (k + 1n) * k) dif.push(j);
        cnt++;
      }
    }
    if (dif.length) {
      dif.sort((a, b) => {
        if (a <= b) return -1;
        else return 1;
      });
      for (let i = 0; i < dif.length; i++) {
        let j = dif[i] % x === 0n ? dif[i] / x - 1n : dif[i] / x;
        if (j > k) break;
        else {
          cnt--;
          k -= j;
        }
      }
      console.log(cnt);
    } else console.log(cnt);
  }
};
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 = 1;
  while (t--) {
    let [n, k, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    arr.sort((a, b) => {
      if (a - b <= 0n) return -1;
      else return 1;
    });
    let dif = [],
      cnt = 1;
    for (let i = 0n; i < n - 1n; i++) {
      if (arr[i + 1n] - arr[i] > x) {
        cnt++;
        dif.push(arr[i + 1n] - arr[i]);
      }
    }
    if (dif.length) {
      dif.sort((a, b) => {
        if (a - b <= 0n) return -1;
        else return 1;
      });
      for (let i = 0; i < dif.length; i++) {
        let j = dif[i] % x === 0 ? dif[i] / x - 1n : dif[i] / x;
        if (j > k) break;
        else {
          cnt--;
          k -= j;
        }
      }
      console.log(cnt);
    } else console.log(cnt);
  }
};
solve();

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 rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	const a = rna();

	a.sort((x, y) => x - y);

	const d = [];
	for (let i = 0; i < n - 1; i++) {
		if (a[i+1] - a[i] > x) {
			d.push(a[i+1] - a[i]);
		}
	}

	d.sort((x, y) =>  x - y);

	let ans = d.length + 1;
	for (const df of d) {
		k -= Math.floor((df-1)/x);
		if (k >= 0) ans--;
	}

	console.log(ans);
}

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 rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	const a = rna();

	a.sort((x, y) => x - y);

	const d = [];
	for (let i = 0; i < n - 1; i++) {
		if (a[i+1] - a[i] > x) {
			d.push(a[i+1] - a[i]);
		}
	}

	d.sort((x, y) =>  x - y);

	let ans = d.length + 1;
	for (const df of d) {
		k -= Math.floor(df/(x+1));
		if (k >= 0) ans--;
	}

	console.log(ans);
}

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 rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	let a = rna();

	a.sort((x, y) => x - y);

	let d = [];
	for (let i = 0; i < n - 1; i++)
		d[i] = a[i + 1] - a[i];

	d.sort((x, y) => x - y);

	let ans = 1, klft = k;
	for (let i = 0; i < d.length; i++) {
		if (d[i] > x) {
			const req = Math.floor((d[i] - 1)/ x);
			if (klft >= req) klft -= req;
			else ans++;
			//console.log('i', i, d[i], x, 'req',req,'klft',klft,'ans',ans)
		}
	}
	console.log(ans);
}

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 rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	let a = rna();

	a.sort((x, y) => x - y);

	let d = [];
	for (let i = 0; i < n - 1; i++)
		d[i] = a[i + 1] - a[i];

	d.sort((x, y) => x - y);

	let ans = 1, klft = k;
	for (let i = 0; i < d.length; i++) {
		if (d[i] > x) {
			const req = Math.floor(d[i] / x);
			if (klft >= req) klft -= req;
			else ans++;
		}
	}
	console.log(ans);
}

// --------------- PRE-DEFINED START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};

const nextBigIntArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => BigInt(num));
};
// --------------- PRE-DEFINED END ---------------

const main = async () => {
  let [n, k, x] = await nextBigIntArr();
  let arr = await nextBigIntArr();

  let gaps = [];

  arr.sort((a, b) => a > b);
  for (let i = 1; i < n; i++) {
    const tmp = arr[i] - arr[i-1];
    if (tmp > x) gaps.push((tmp / x) - (tmp % x === 0n ? 1n : 0n));
  }

  gaps.sort((a, b) => a > b);
  let res = gaps.length + 1;
  for (let i = 0; i < gaps.length; i++) {
    if (gaps[i] > k) break;
    k -= gaps[i];
    res -= 1;
  }

  console.log(res);
};

main();

// --------------- PRE-DEFINED START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};
// --------------- PRE-DEFINED END ---------------

const main = async () => {
  let [n, k, x] = await nextNumArr();
  let arr = await nextNumArr();

  let gaps = [];

  arr.sort((a, b) => a - b);
  for (let i = 1; i < n; i++) {
    const tmp = arr[i] - arr[i-1];
    if (tmp > x) gaps.push(Math.floor((tmp + x - 1) / x) - 1);
  }

  gaps.sort((a, b) => a - b);
  let res = gaps.length + 1;
  for (let i = 0; i < gaps.length; i++) {
    if (gaps[i] > k) break;
    k -= gaps[i];
    res -= 1;
  }

  console.log(res);
};

main();

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

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => ((await getLineGen.next()).value);
})();

let solve = async () => {
    let strn, strk, strx;
    let n, k, x;
    [n, k, x] = (await getLine()).split(' ').map(num => parseInt(num));
    const a = (await getLine()).split(' ').map(num => parseInt(num));
    let bigcmp = function(a,b) {
        const zero = BigInt(0);
        const diff = a-b;
        if (diff < zero)
            return -1;
        else if (diff > zero)
            return 1;
        else return 0;
    }
    a.sort((a,b) => (a-b));
    const diffs = [];
    for(let i = 1; i < n; i++) {
       if (a[i] - a[i-1] > x) {
           diffs.push(a[i]-a[i-1]);
       }
    }
    diffs.sort((a,b)=>(a-b));
    let i;
    for(i = 0; i<diffs.length && k > 0; i++) {
        let need = ((diffs[i] - 1) / x);
       if (need > k)
           break;
       else
           k -= need;
    }
    console.log(diffs.length - i + 1);
}

solve();

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    var [n, k, x] = lines[l++].split(' ').map(BigInt);
    var arr = lines[l++].split(' ').map(BigInt);
    console.log(solve(n, k, x, arr))
});

function solve(n, k, x, arr) {
    const cp = (a, b) => {
        if (a < b) {
            return -1
        } else if (a > b) {
            return 1
        } else {
            return 0
        }
    }
    arr.sort(cp)

    const needs = []
    arr.forEach((item, i) => {
        if (i && item - arr[i - 1] > x) {
            const need = ceil((item - arr[i - 1]), x) - 1n
            needs.push(need)
        }
    })
    needs.sort(cp)

    let sum = 0n
    for (let i = 0; i < needs.length; i++) {
        if (sum + needs[i] > k) {
            return needs.length - i + 1
        }
        sum += needs[i]
    }
    return 1
}

function ceil(a, b) {
    const r = a % b
    return (a - r) / b
}


const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
let last = 0;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    console.log(Array
      .from(line)
      .reduceRight((res, ele, index) => {
        if (ele === 'A') {
          res = Math.max(res, last - index - 1);
          last = index;
        } else {
          res = res;
        }
        return res;
    }, 0))
  } else if (T !== -1) {
    num = line;
    last = num;
  }
  T ++;
})

var stdin = process.openStdin();

stdin.addListener("data", function(d) {
    const arr = d.toString().trim().split('\n').map(e => e.trim());
    for(let i=1; i < arr.length; i++){
        if(i % 2 === 0){
            console.log(findm(arr[i]));
        }
    }
});

function findm(students){
    let str = students;
    let counter = 0, j = 1;
    let arr = str.split(/A+/).map(e => e.length);
    let max = 0;
    for(let i = 1; i < arr.length; i++){
        if(max < arr[i]){
            max = arr[i];
        }
    }
    return max;
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;

rl.on('line', (str) => {
  if (c === 0) {
    c++;
    return;
  }

  if (c % 2 === 1) {
    c++;
    return;
  }

  let ans = 0;
  const startPoint = str.indexOf('A') > -1 ? str.indexOf('A') : str.length;

  for (let i = startPoint; i < str.length; i++) {
    let count = 0;

    while (str[i] === 'P') {
      count++;
      i++;
    }

    ans = Math.max(ans, count);
  }

  console.log(ans);
  c++;
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
let last = 0;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    console.log(Array
      .from(line)
      .reduceRight((res, ele, index) => {
        if (ele === 'A') {
          res = Math.max(res, last - index - 1);
          last = index;
        }
        return res;
    }, 0))
  } else if (T !== -1) {
    num = line;
    last = num;
  }
  T ++;
})

    var t;
    t=readline();
    while (t--){
        var ans=0; var c=0,str,n;
        n=readline();
        str=readline();
        for (var i=n-1; i>-1; i--){
             if (str[i]=='P')
             c++;
             else {if (c>ans)
             ans=c;
             c=0;
             }
            }
            print (ans);
        }

var queries = parseInt(readline());
for(var i = 0; i< queries;i++){
var discard = readline();
var myString = readline();
var val = myString.split(/[A]/);
while (val[val.length-1] == ""){
  val.pop();
}
if (val[0] == ""){
while (val[0] == ""){
  val.shift();
}
}
else{
  val.shift();
}
var result = val.reduce((sum,ele)=>{
  if (ele.length > sum){
    return sum += ele.length - sum;
  }
  else{
    return sum;
  }
},0)
print(result);
}

"use strict";var readline=require("readline");function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_nonIterableSpread()}function _arrayWithoutHoles(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}function _iterableToArray(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function __extends(t,e){function r(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function isFunction(t){return"function"==typeof t}var _enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;_enable_super_gross_mode_that_will_cause_bad_things=t},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}};function hostReportError(t){setTimeout((function(){throw t}),0)}var empty={closed:!0,next:function(t){},error:function(t){if(config.useDeprecatedSynchronousErrorHandling)throw t;hostReportError(t)},complete:function(){}},isArray=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}();function isObject(t){return null!==t&&"object"==typeof t}var UnsubscriptionErrorImpl=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(t,e){return e+1+") "+t.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),UnsubscriptionError=UnsubscriptionErrorImpl,Subscription=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var r=this._parentOrParents,n=this._unsubscribe,o=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof t)r.remove(this);else if(null!==r)for(var i=0;i<r.length;++i){r[i].remove(this)}if(isFunction(n))try{n.call(this)}catch(t){e=t instanceof UnsubscriptionError?flattenUnsubscriptionErrors(t.errors):[t]}if(isArray(o)){i=-1;for(var c=o.length;++i<c;){var a=o[i];if(isObject(a))try{a.unsubscribe()}catch(t){e=e||[],t instanceof UnsubscriptionError?e=e.concat(flattenUnsubscriptionErrors(t.errors)):e.push(t)}}}if(e)throw new UnsubscriptionError(e)}},t.prototype.add=function(e){var r=e;if(!e)return t.EMPTY;switch(typeof e){case"function":r=new t(e);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof t)){var n=r;(r=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var o=r._parentOrParents;if(null===o)r._parentOrParents=this;else if(o instanceof t){if(o===this)return r;r._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return r;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[r]:i.push(r),r},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function flattenUnsubscriptionErrors(t){return t.reduce((function(t,e){return t.concat(e instanceof UnsubscriptionError?e.errors:e)}),[])}var rxSubscriber=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),Subscriber=function(t){function e(r,n,o){var i=t.call(this)||this;switch(i.syncErrorValue=null,i.syncErrorThrown=!1,i.syncErrorThrowable=!1,i.isStopped=!1,arguments.length){case 0:i.destination=empty;break;case 1:if(!r){i.destination=empty;break}if("object"==typeof r){r instanceof e?(i.syncErrorThrowable=r.syncErrorThrowable,i.destination=r,r.add(i)):(i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,r));break}default:i.syncErrorThrowable=!0,i.destination=new SafeSubscriber(i,r,n,o)}return i}return __extends(e,t),e.prototype[rxSubscriber]=function(){return this},e.create=function(t,r,n){var o=new e(t,r,n);return o.syncErrorThrowable=!1,o},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(Subscription),SafeSubscriber=function(t){function e(e,r,n,o){var i,c=t.call(this)||this;c._parentSubscriber=e;var a=c;return isFunction(r)?i=r:r&&(i=r.next,n=r.error,o=r.complete,r!==empty&&(isFunction((a=Object.create(r)).unsubscribe)&&c.add(a.unsubscribe.bind(a)),a.unsubscribe=c.unsubscribe.bind(c))),c._context=a,c._next=i,c._error=n,c._complete=o,c}return __extends(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,r=config.useDeprecatedSynchronousErrorHandling;if(this._error)r&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)r?(e.syncErrorValue=t,e.syncErrorThrown=!0):hostReportError(t),this.unsubscribe();else{if(this.unsubscribe(),r)throw t;hostReportError(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var r=function(){return t._complete.call(t._context)};config.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw t;hostReportError(t)}},e.prototype.__tryOrSetError=function(t,e,r){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,r)}catch(e){return config.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(hostReportError(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(Subscriber);function canReportError(t){for(;t;){var e=t,r=e.closed,n=e.destination,o=e.isStopped;if(r||o)return!1;t=n&&n instanceof Subscriber?n:null}return!0}function toSubscriber(t,e,r){if(t){if(t instanceof Subscriber)return t;if(t[rxSubscriber])return t[rxSubscriber]()}return t||e||r?new Subscriber(t,e,r):new Subscriber(empty)}var observable=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}();function noop(){}function pipeFromArray(t){return t?1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}:noop}var Observable=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n=this.operator,o=toSubscriber(t,e,r);if(n?o.add(n.call(o,this.source)):o.add(this.source||config.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),config.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){config.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),canReportError(t)?t.error(e):console.warn(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=getPromiseCtor(e))((function(e,n){var o;o=r.subscribe((function(e){try{t(e)}catch(t){n(t),o&&o.unsubscribe()}}),n,e)}))},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[observable]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:pipeFromArray(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=getPromiseCtor(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function getPromiseCtor(t){if(t||(t=Promise),!t)throw new Error("no Promise impl found");return t}function tnLineStdinReader(){return new Observable((function(t){var e=readline.createInterface(process.stdin),r=null,n=null;e.on("line",(function(o){null===r?r=+o:null===n?(n=+o,r--):(n=null,t.next(o),0===r&&(e.close(),t.complete()))}))}))}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var check=function(t){return t&&t.Math==Math&&t},global_1=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},descriptors=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),nativePropertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor&&!nativePropertyIsEnumerable.call({1:2},1),f=NASHORN_BUG?function(t){var e=getOwnPropertyDescriptor(this,t);return!!e&&e.enumerable}:nativePropertyIsEnumerable,objectPropertyIsEnumerable={f:f},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},toString={}.toString,classofRaw=function(t){return toString.call(t).slice(8,-1)},split="".split,indexedObject=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?split.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return indexedObject(requireObjectCoercible(t))},isObject$1=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject$1(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject$1(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject$1(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject$1(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},hasOwnProperty={}.hasOwnProperty,has=function(t,e){return hasOwnProperty.call(t,e)},document$1=global_1.document,EXISTS=isObject$1(document$1)&&isObject$1(document$1.createElement),documentCreateElement=function(t){return EXISTS?document$1.createElement(t):{}},ie8DomDefine=!descriptors&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),nativeGetOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,f$1=descriptors?nativeGetOwnPropertyDescriptor:function(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),ie8DomDefine)try{return nativeGetOwnPropertyDescriptor(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(t,e),t[e])},objectGetOwnPropertyDescriptor={f:f$1},anObject=function(t){if(!isObject$1(t))throw TypeError(String(t)+" is not an object");return t},nativeDefineProperty=Object.defineProperty,f$2=descriptors?nativeDefineProperty:function(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),ie8DomDefine)try{return nativeDefineProperty(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t},objectDefineProperty={f:f$2},createNonEnumerableProperty=descriptors?function(t,e,r){return objectDefineProperty.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,e){try{createNonEnumerableProperty(global_1,t,e)}catch(r){global_1[t]=e}return e},SHARED="__core-js_shared__",store=global_1[SHARED]||setGlobal(SHARED,{}),sharedStore=store,functionToString=Function.toString;"function"!=typeof sharedStore.inspectSource&&(sharedStore.inspectSource=function(t){return functionToString.call(t)});var set,get,has$1,inspectSource=sharedStore.inspectSource,WeakMap=global_1.WeakMap,nativeWeakMap="function"==typeof WeakMap&&/native code/.test(inspectSource(WeakMap)),isPure=!1,shared=createCommonjsModule((function(t){(t.exports=function(t,e){return sharedStore[t]||(sharedStore[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.2",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),id=0,postfix=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++id+postfix).toString(36)},keys=shared("keys"),sharedKey=function(t){return keys[t]||(keys[t]=uid(t))},hiddenKeys={},WeakMap$1=global_1.WeakMap,enforce=function(t){return has$1(t)?get(t):set(t,{})},getterFor=function(t){return function(e){var r;if(!isObject$1(e)||(r=get(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}};if(nativeWeakMap){var store$1=new WeakMap$1,wmget=store$1.get,wmhas=store$1.has,wmset=store$1.set;set=function(t,e){return wmset.call(store$1,t,e),e},get=function(t){return wmget.call(store$1,t)||{}},has$1=function(t){return wmhas.call(store$1,t)}}else{var STATE=sharedKey("state");hiddenKeys[STATE]=!0,set=function(t,e){return createNonEnumerableProperty(t,STATE,e),e},get=function(t){return has(t,STATE)?t[STATE]:{}},has$1=function(t){return has(t,STATE)}}var internalState={set:set,get:get,has:has$1,enforce:enforce,getterFor:getterFor},redefine=createCommonjsModule((function(t){var e=internalState.get,r=internalState.enforce,n=String(String).split("String");(t.exports=function(t,e,o,i){var c=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||has(o,"name")||createNonEnumerableProperty(o,"name",e),r(o).source=n.join("string"==typeof e?e:"")),t!==global_1?(c?!s&&t[e]&&(a=!0):delete t[e],a?t[e]=o:createNonEnumerableProperty(t,e,o)):a?t[e]=o:setGlobal(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||inspectSource(this)}))})),path=global_1,aFunction=function(t){return"function"==typeof t?t:void 0},getBuiltIn=function(t,e){return arguments.length<2?aFunction(path[t])||aFunction(global_1[t]):path[t]&&path[t][e]||global_1[t]&&global_1[t][e]},ceil=Math.ceil,floor=Math.floor,toInteger=function(t){return isNaN(t=+t)?0:(t>0?floor:ceil)(t)},min=Math.min,toLength=function(t){return t>0?min(toInteger(t),9007199254740991):0},max=Math.max,min$1=Math.min,toAbsoluteIndex=function(t,e){var r=toInteger(t);return r<0?max(r+e,0):min$1(r,e)},createMethod=function(t){return function(e,r,n){var o,i=toIndexedObject(e),c=toLength(i.length),a=toAbsoluteIndex(n,c);if(t&&r!=r){for(;c>a;)if((o=i[a++])!=o)return!0}else for(;c>a;a++)if((t||a in i)&&i[a]===r)return t||a||0;return!t&&-1}},arrayIncludes={includes:createMethod(!0),indexOf:createMethod(!1)},indexOf=arrayIncludes.indexOf,objectKeysInternal=function(t,e){var r,n=toIndexedObject(t),o=0,i=[];for(r in n)!has(hiddenKeys,r)&&has(n,r)&&i.push(r);for(;e.length>o;)has(n,r=e[o++])&&(~indexOf(i,r)||i.push(r));return i},enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hiddenKeys$1=enumBugKeys.concat("length","prototype"),f$3=Object.getOwnPropertyNames||function(t){return objectKeysInternal(t,hiddenKeys$1)},objectGetOwnPropertyNames={f:f$3},f$4=Object.getOwnPropertySymbols,objectGetOwnPropertySymbols={f:f$4},ownKeys=getBuiltIn("Reflect","ownKeys")||function(t){var e=objectGetOwnPropertyNames.f(anObject(t)),r=objectGetOwnPropertySymbols.f;return r?e.concat(r(t)):e},copyConstructorProperties=function(t,e){for(var r=ownKeys(e),n=objectDefineProperty.f,o=objectGetOwnPropertyDescriptor.f,i=0;i<r.length;i++){var c=r[i];has(t,c)||n(t,c,o(e,c))}},replacement=/#|\.prototype\./,isForced=function(t,e){var r=data[normalize(t)];return r==POLYFILL||r!=NATIVE&&("function"==typeof e?fails(e):!!e)},normalize=isForced.normalize=function(t){return String(t).replace(replacement,".").toLowerCase()},data=isForced.data={},NATIVE=isForced.NATIVE="N",POLYFILL=isForced.POLYFILL="P",isForced_1=isForced,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,_export=function(t,e){var r,n,o,i,c,a=t.target,s=t.global,u=t.stat;if(r=s?global_1:u?global_1[a]||setGlobal(a,{}):(global_1[a]||{}).prototype)for(n in e){if(i=e[n],o=t.noTargetGet?(c=getOwnPropertyDescriptor$1(r,n))&&c.value:r[n],!isForced_1(s?n:a+(u?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;copyConstructorProperties(i,o)}(t.sham||o&&o.sham)&&createNonEnumerableProperty(i,"sham",!0),redefine(r,n,i,t)}},regexpFlags=function(){var t=anObject(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e};function RE(t,e){return RegExp(t,e)}var UNSUPPORTED_Y=fails((function(){var t=RE("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),BROKEN_CARET=fails((function(){var t=RE("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),regexpStickyHelpers={UNSUPPORTED_Y:UNSUPPORTED_Y,BROKEN_CARET:BROKEN_CARET},nativeExec=RegExp.prototype.exec,nativeReplace=String.prototype.replace,patchedExec=nativeExec,UPDATES_LAST_INDEX_WRONG=function(){var t=/a/,e=/b*/g;return nativeExec.call(t,"a"),nativeExec.call(e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),UNSUPPORTED_Y$1=regexpStickyHelpers.UNSUPPORTED_Y||regexpStickyHelpers.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$1;PATCH&&(patchedExec=function(t){var e,r,n,o,i=this,c=UNSUPPORTED_Y$1&&i.sticky,a=regexpFlags.call(i),s=i.source,u=0,l=t;return c&&(-1===(a=a.replace("y","")).indexOf("g")&&(a+="g"),l=String(t).slice(i.lastIndex),i.lastIndex>0&&(!i.multiline||i.multiline&&"\n"!==t[i.lastIndex-1])&&(s="(?: "+s+")",l=" "+l,u++),r=new RegExp("^(?:"+s+")",a)),NPCG_INCLUDED&&(r=new RegExp("^"+s+"$(?!\\s)",a)),UPDATES_LAST_INDEX_WRONG&&(e=i.lastIndex),n=nativeExec.call(c?r:i,l),c?n?(n.input=n.input.slice(u),n[0]=n[0].slice(u),n.index=i.lastIndex,i.lastIndex+=n[0].length):i.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&n&&(i.lastIndex=i.global?n.index+n[0].length:e),NPCG_INCLUDED&&n&&n.length>1&&nativeReplace.call(n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n});var regexpExec=patchedExec;_export({target:"RegExp",proto:!0,forced:/./.exec!==regexpExec},{exec:regexpExec});var fromCharCode=String.fromCharCode,nativeFromCodePoint=String.fromCodePoint,INCORRECT_LENGTH=!!nativeFromCodePoint&&1!=nativeFromCodePoint.length;_export({target:"String",stat:!0,forced:INCORRECT_LENGTH},{fromCodePoint:function(t){for(var e,r=[],n=arguments.length,o=0;n>o;){if(e=+arguments[o++],toAbsoluteIndex(e,1114111)!==e)throw RangeError(e+" is not a valid code point");r.push(e<65536?fromCharCode(e):fromCharCode(55296+((e-=65536)>>10),e%1024+56320))}return r.join("")}}),_export({target:"String",stat:!0},{raw:function(t){for(var e=toIndexedObject(t.raw),r=toLength(e.length),n=arguments.length,o=[],i=0;r>i;)o.push(String(e[i++])),i<n&&o.push(String(arguments[i]));return o.join("")}});var createMethod$1=function(t){return function(e,r){var n,o,i=String(requireObjectCoercible(e)),c=toInteger(r),a=i.length;return c<0||c>=a?t?"":void 0:(n=i.charCodeAt(c))<55296||n>56319||c+1===a||(o=i.charCodeAt(c+1))<56320||o>57343?t?i.charAt(c):n:t?i.slice(c,c+2):o-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$1(!1),charAt:createMethod$1(!0)},codeAt=stringMultibyte.codeAt;_export({target:"String",proto:!0},{codePointAt:function(t){return codeAt(this,t)}});var nativeSymbol=!!Object.getOwnPropertySymbols&&!fails((function(){return!String(Symbol())})),useSymbolAsUid=nativeSymbol&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,WellKnownSymbolsStore=shared("wks"),Symbol$1=global_1.Symbol,createWellKnownSymbol=useSymbolAsUid?Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid,wellKnownSymbol=function(t){return has(WellKnownSymbolsStore,t)||(nativeSymbol&&has(Symbol$1,t)?WellKnownSymbolsStore[t]=Symbol$1[t]:WellKnownSymbolsStore[t]=createWellKnownSymbol("Symbol."+t)),WellKnownSymbolsStore[t]},MATCH=wellKnownSymbol("match"),isRegexp=function(t){var e;return isObject$1(t)&&(void 0!==(e=t[MATCH])?!!e:"RegExp"==classofRaw(t))},notARegexp=function(t){if(isRegexp(t))throw TypeError("The method doesn't accept regular expressions");return t},MATCH$1=wellKnownSymbol("match"),correctIsRegexpLogic=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[MATCH$1]=!1,"/./"[t](e)}catch(t){}}return!1},getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,nativeEndsWith="".endsWith,min$2=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegexpLogic("endsWith"),MDN_POLYFILL_BUG=!CORRECT_IS_REGEXP_LOGIC&&!!function(){var t=getOwnPropertyDescriptor$2(String.prototype,"endsWith");return t&&!t.writable}();_export({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG&&!CORRECT_IS_REGEXP_LOGIC},{endsWith:function(t){var e=String(requireObjectCoercible(this));notARegexp(t);var r=arguments.length>1?arguments[1]:void 0,n=toLength(e.length),o=void 0===r?n:min$2(toLength(r),n),i=String(t);return nativeEndsWith?nativeEndsWith.call(e,i,o):e.slice(o-i.length,o)===i}}),_export({target:"String",proto:!0,forced:!correctIsRegexpLogic("includes")},{includes:function(t){return!!~String(requireObjectCoercible(this)).indexOf(notARegexp(t),arguments.length>1?arguments[1]:void 0)}});var SPECIES=wellKnownSymbol("species"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),SPLIT_WORKS_WITH_OVERWRITTEN_EXEC=!fails((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),fixRegexpWellKnownSymbolLogic=function(t,e,r,n){var o=wellKnownSymbol(t),i=!fails((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),c=i&&!fails((function(){var e=!1,r=/a/;return"split"===t&&((r={}).constructor={},r.constructor[SPECIES]=function(){return r},r.flags="",r[o]=/./[o]),r.exec=function(){return e=!0,null},r[o](""),!e}));if(!i||!c||"replace"===t&&(!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0)||"split"===t&&!SPLIT_WORKS_WITH_OVERWRITTEN_EXEC){var a=/./[o],s=r(o,""[t],(function(t,e,r,n,o){return e.exec===regexpExec?i&&!o?{done:!0,value:a.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}}),{REPLACE_KEEPS_$0:REPLACE_KEEPS_$0}),u=s[0],l=s[1];redefine(String.prototype,t,u),redefine(RegExp.prototype,o,2==e?function(t,e){return l.call(t,this,e)}:function(t){return l.call(t,this)})}n&&createNonEnumerableProperty(RegExp.prototype[o],"sham",!0)},charAt=stringMultibyte.charAt,advanceStringIndex=function(t,e,r){return e+(r?charAt(t,e).length:1)},regexpExecAbstract=function(t,e){var r=t.exec;if("function"==typeof r){var n=r.call(t,e);if("object"!=typeof n)throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==classofRaw(t))throw TypeError("RegExp#exec called on incompatible receiver");return regexpExec.call(t,e)};fixRegexpWellKnownSymbolLogic("match",1,(function(t,e,r){return[function(e){var r=requireObjectCoercible(this),n=null==e?void 0:e[t];return void 0!==n?n.call(e,r):new RegExp(e)[t](String(r))},function(t){var n=r(e,t,this);if(n.done)return n.value;var o=anObject(t),i=String(this);if(!o.global)return regexpExecAbstract(o,i);var c=o.unicode;o.lastIndex=0;for(var a,s=[],u=0;null!==(a=regexpExecAbstract(o,i));){var l=String(a[0]);s[u]=l,""===l&&(o.lastIndex=advanceStringIndex(i,toLength(o.lastIndex),c)),u++}return 0===u?null:s}]}));var IteratorPrototype,PrototypeOfArrayIteratorPrototype,arrayIterator,toObject=function(t){return Object(requireObjectCoercible(t))},correctPrototypeGetter=!fails((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),IE_PROTO=sharedKey("IE_PROTO"),ObjectPrototype=Object.prototype,objectGetPrototypeOf=correctPrototypeGetter?Object.getPrototypeOf:function(t){return t=toObject(t),has(t,IE_PROTO)?t[IE_PROTO]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?ObjectPrototype:null},ITERATOR=wellKnownSymbol("iterator"),BUGGY_SAFARI_ITERATORS=!1,returnThis=function(){return this};[].keys&&("next"in(arrayIterator=[].keys())?(PrototypeOfArrayIteratorPrototype=objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)))!==Object.prototype&&(IteratorPrototype=PrototypeOfArrayIteratorPrototype):BUGGY_SAFARI_ITERATORS=!0),null==IteratorPrototype&&(IteratorPrototype={}),has(IteratorPrototype,ITERATOR)||createNonEnumerableProperty(IteratorPrototype,ITERATOR,returnThis);var activeXDocument,iteratorsCore={IteratorPrototype:IteratorPrototype,BUGGY_SAFARI_ITERATORS:BUGGY_SAFARI_ITERATORS},objectKeys=Object.keys||function(t){return objectKeysInternal(t,enumBugKeys)},objectDefineProperties=descriptors?Object.defineProperties:function(t,e){anObject(t);for(var r,n=objectKeys(e),o=n.length,i=0;o>i;)objectDefineProperty.f(t,r=n[i++],e[r]);return t},html=getBuiltIn("document","documentElement"),GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO$1=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return LT+SCRIPT+GT+t+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var e=t.parentWindow.Object;return t=null,e},NullProtoObjectViaIFrame=function(){var t,e=documentCreateElement("iframe"),r="java"+SCRIPT+":";return e.style.display="none",html.appendChild(e),e.src=String(r),(t=e.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F},NullProtoObject=function(){try{activeXDocument=document.domain&&new ActiveXObject("htmlfile")}catch(t){}NullProtoObject=activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame();for(var t=enumBugKeys.length;t--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[t]];return NullProtoObject()};hiddenKeys[IE_PROTO$1]=!0;var objectCreate=Object.create||function(t,e){var r;return null!==t?(EmptyConstructor[PROTOTYPE]=anObject(t),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,r[IE_PROTO$1]=t):r=NullProtoObject(),void 0===e?r:objectDefineProperties(r,e)},defineProperty=objectDefineProperty.f,TO_STRING_TAG=wellKnownSymbol("toStringTag"),setToStringTag=function(t,e,r){t&&!has(t=r?t:t.prototype,TO_STRING_TAG)&&defineProperty(t,TO_STRING_TAG,{configurable:!0,value:e})},IteratorPrototype$1=iteratorsCore.IteratorPrototype,createIteratorConstructor=function(t,e,r){var n=e+" Iterator";return t.prototype=objectCreate(IteratorPrototype$1,{next:createPropertyDescriptor(1,r)}),setToStringTag(t,n,!1),t},aFunction$1=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},SPECIES$1=wellKnownSymbol("species"),speciesConstructor=function(t,e){var r,n=anObject(t).constructor;return void 0===n||null==(r=anObject(n)[SPECIES$1])?e:aFunction$1(r)},MATCH_ALL=wellKnownSymbol("matchAll"),REGEXP_STRING="RegExp String",REGEXP_STRING_ITERATOR=REGEXP_STRING+" Iterator",setInternalState=internalState.set,getInternalState=internalState.getterFor(REGEXP_STRING_ITERATOR),RegExpPrototype=RegExp.prototype,regExpBuiltinExec=RegExpPrototype.exec,nativeMatchAll="".matchAll,WORKS_WITH_NON_GLOBAL_REGEX=!!nativeMatchAll&&!fails((function(){"a".matchAll(/./)})),regExpExec=function(t,e){var r,n=t.exec;if("function"==typeof n){if("object"!=typeof(r=n.call(t,e)))throw TypeError("Incorrect exec result");return r}return regExpBuiltinExec.call(t,e)},$RegExpStringIterator=createIteratorConstructor((function(t,e,r,n){setInternalState(this,{type:REGEXP_STRING_ITERATOR,regexp:t,string:e,global:r,unicode:n,done:!1})}),REGEXP_STRING,(function(){var t=getInternalState(this);if(t.done)return{value:void 0,done:!0};var e=t.regexp,r=t.string,n=regExpExec(e,r);return null===n?{value:void 0,done:t.done=!0}:t.global?(""==String(n[0])&&(e.lastIndex=advanceStringIndex(r,toLength(e.lastIndex),t.unicode)),{value:n,done:!1}):(t.done=!0,{value:n,done:!1})})),$matchAll=function(t){var e,r,n,o,i,c,a=anObject(this),s=String(t);return e=speciesConstructor(a,RegExp),void 0===(r=a.flags)&&a instanceof RegExp&&!("flags"in RegExpPrototype)&&(r=regexpFlags.call(a)),n=void 0===r?"":String(r),o=new e(e===RegExp?a.source:a,n),i=!!~n.indexOf("g"),c=!!~n.indexOf("u"),o.lastIndex=toLength(a.lastIndex),new $RegExpStringIterator(o,s,i,c)};_export({target:"String",proto:!0,forced:WORKS_WITH_NON_GLOBAL_REGEX},{matchAll:function(t){var e,r,n=requireObjectCoercible(this);if(null!=t){if(isRegexp(t)&&!~String(requireObjectCoercible("flags"in RegExpPrototype?t.flags:regexpFlags.call(t))).indexOf("g"))throw TypeError("`.matchAll` does not allow non-global regexes");if(WORKS_WITH_NON_GLOBAL_REGEX)return nativeMatchAll.apply(n,arguments);if(void 0===(r=t[MATCH_ALL])&&isPure&&"RegExp"==classofRaw(t)&&(r=$matchAll),null!=r)return aFunction$1(r).call(t,n)}else if(WORKS_WITH_NON_GLOBAL_REGEX)return nativeMatchAll.apply(n,arguments);return e=String(n),new RegExp(t,"g")[MATCH_ALL](e)}}),MATCH_ALL in RegExpPrototype||createNonEnumerableProperty(RegExpPrototype,MATCH_ALL,$matchAll);var stringRepeat="".repeat||function(t){var e=String(requireObjectCoercible(this)),r="",n=toInteger(t);if(n<0||n==1/0)throw RangeError("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(e+=e))1&n&&(r+=e);return r},ceil$1=Math.ceil,createMethod$2=function(t){return function(e,r,n){var o,i,c=String(requireObjectCoercible(e)),a=c.length,s=void 0===n?" ":String(n),u=toLength(r);return u<=a||""==s?c:(o=u-a,(i=stringRepeat.call(s,ceil$1(o/s.length))).length>o&&(i=i.slice(0,o)),t?c+i:i+c)}},stringPad={start:createMethod$2(!1),end:createMethod$2(!0)},engineUserAgent=getBuiltIn("navigator","userAgent")||"",stringPadWebkitBug=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(engineUserAgent),$padEnd=stringPad.end;_export({target:"String",proto:!0,forced:stringPadWebkitBug},{padEnd:function(t){return $padEnd(this,t,arguments.length>1?arguments[1]:void 0)}});var $padStart=stringPad.start;_export({target:"String",proto:!0,forced:stringPadWebkitBug},{padStart:function(t){return $padStart(this,t,arguments.length>1?arguments[1]:void 0)}}),_export({target:"String",proto:!0},{repeat:stringRepeat});var max$1=Math.max,min$3=Math.min,floor$1=Math.floor,SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d\d?|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d\d?)/g,maybeToString=function(t){return void 0===t?t:String(t)};fixRegexpWellKnownSymbolLogic("replace",2,(function(t,e,r,n){return[function(r,n){var o=requireObjectCoercible(this),i=null==r?void 0:r[t];return void 0!==i?i.call(r,o,n):e.call(String(o),r,n)},function(t,i){if(n.REPLACE_KEEPS_$0||"string"==typeof i&&-1===i.indexOf("$0")){var c=r(e,t,this,i);if(c.done)return c.value}var a=anObject(t),s=String(this),u="function"==typeof i;u||(i=String(i));var l=a.global;if(l){var p=a.unicode;a.lastIndex=0}for(var f=[];;){var g=regexpExecAbstract(a,s);if(null===g)break;if(f.push(g),!l)break;""===String(g[0])&&(a.lastIndex=advanceStringIndex(s,toLength(a.lastIndex),p))}for(var h="",b=0,d=0;d<f.length;d++){g=f[d];for(var y=String(g[0]),S=max$1(min$3(toInteger(g.index),s.length),0),E=[],_=1;_<g.length;_++)E.push(maybeToString(g[_]));var m=g.groups;if(u){var O=[y].concat(E,S,s);void 0!==m&&O.push(m);var v=String(i.apply(void 0,O))}else v=o(y,s,S,E,m,i);S>=b&&(h+=s.slice(b,S)+v,b=S+y.length)}return h+s.slice(b)}];function o(t,r,n,o,i,c){var a=n+t.length,s=o.length,u=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==i&&(i=toObject(i),u=SUBSTITUTION_SYMBOLS),e.call(c,u,(function(e,c){var u;switch(c.charAt(0)){case"$":return"$";case"&":return t;case"`":return r.slice(0,n);case"'":return r.slice(a);case"<":u=i[c.slice(1,-1)];break;default:var l=+c;if(0===l)return e;if(l>s){var p=floor$1(l/10);return 0===p?e:p<=s?void 0===o[p-1]?c.charAt(1):o[p-1]+c.charAt(1):e}u=o[l-1]}return void 0===u?"":u}))}}));var sameValue=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e};fixRegexpWellKnownSymbolLogic("search",1,(function(t,e,r){return[function(e){var r=requireObjectCoercible(this),n=null==e?void 0:e[t];return void 0!==n?n.call(e,r):new RegExp(e)[t](String(r))},function(t){var n=r(e,t,this);if(n.done)return n.value;var o=anObject(t),i=String(this),c=o.lastIndex;sameValue(c,0)||(o.lastIndex=0);var a=regexpExecAbstract(o,i);return sameValue(o.lastIndex,c)||(o.lastIndex=c),null===a?-1:a.index}]}));var arrayPush=[].push,min$4=Math.min,MAX_UINT32=4294967295,SUPPORTS_Y=!fails((function(){return!RegExp(MAX_UINT32,"y")}));fixRegexpWellKnownSymbolLogic("split",2,(function(t,e,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,r){var n=String(requireObjectCoercible(this)),o=void 0===r?MAX_UINT32:r>>>0;if(0===o)return[];if(void 0===t)return[n];if(!isRegexp(t))return e.call(n,t,o);for(var i,c,a,s=[],u=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,p=new RegExp(t.source,u+"g");(i=regexpExec.call(p,n))&&!((c=p.lastIndex)>l&&(s.push(n.slice(l,i.index)),i.length>1&&i.index<n.length&&arrayPush.apply(s,i.slice(1)),a=i[0].length,l=c,s.length>=o));)p.lastIndex===i.index&&p.lastIndex++;return l===n.length?!a&&p.test("")||s.push(""):s.push(n.slice(l)),s.length>o?s.slice(0,o):s}:"0".split(void 0,0).length?function(t,r){return void 0===t&&0===r?[]:e.call(this,t,r)}:e,[function(e,r){var o=requireObjectCoercible(this),i=null==e?void 0:e[t];return void 0!==i?i.call(e,o,r):n.call(String(o),e,r)},function(t,o){var i=r(n,t,this,o,n!==e);if(i.done)return i.value;var c=anObject(t),a=String(this),s=speciesConstructor(c,RegExp),u=c.unicode,l=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(SUPPORTS_Y?"y":"g"),p=new s(SUPPORTS_Y?c:"^(?:"+c.source+")",l),f=void 0===o?MAX_UINT32:o>>>0;if(0===f)return[];if(0===a.length)return null===regexpExecAbstract(p,a)?[a]:[];for(var g=0,h=0,b=[];h<a.length;){p.lastIndex=SUPPORTS_Y?h:0;var d,y=regexpExecAbstract(p,SUPPORTS_Y?a:a.slice(h));if(null===y||(d=min$4(toLength(p.lastIndex+(SUPPORTS_Y?0:h)),a.length))===g)h=advanceStringIndex(a,h,u);else{if(b.push(a.slice(g,h)),b.length===f)return b;for(var S=1;S<=y.length-1;S++)if(b.push(y[S]),b.length===f)return b;h=g=d}}return b.push(a.slice(g)),b}]}),!SUPPORTS_Y);var getOwnPropertyDescriptor$3=objectGetOwnPropertyDescriptor.f,nativeStartsWith="".startsWith,min$5=Math.min,CORRECT_IS_REGEXP_LOGIC$1=correctIsRegexpLogic("startsWith"),MDN_POLYFILL_BUG$1=!CORRECT_IS_REGEXP_LOGIC$1&&!!function(){var t=getOwnPropertyDescriptor$3(String.prototype,"startsWith");return t&&!t.writable}();_export({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG$1&&!CORRECT_IS_REGEXP_LOGIC$1},{startsWith:function(t){var e=String(requireObjectCoercible(this));notARegexp(t);var r=toLength(min$5(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return nativeStartsWith?nativeStartsWith.call(e,n,r):e.slice(r,r+n.length)===n}});var whitespaces="\t\n\v\f\r                　\u2028\u2029\ufeff",whitespace="["+whitespaces+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$3=function(t){return function(e){var r=String(requireObjectCoercible(e));return 1&t&&(r=r.replace(ltrim,"")),2&t&&(r=r.replace(rtrim,"")),r}},stringTrim={start:createMethod$3(1),end:createMethod$3(2),trim:createMethod$3(3)},non="",stringTrimForced=function(t){return fails((function(){return!!whitespaces[t]()||non[t]()!=non||whitespaces[t].name!==t}))},$trim=stringTrim.trim;_export({target:"String",proto:!0,forced:stringTrimForced("trim")},{trim:function(){return $trim(this)}});var $trimStart=stringTrim.start,FORCED=stringTrimForced("trimStart"),trimStart=FORCED?function(){return $trimStart(this)}:"".trimStart;_export({target:"String",proto:!0,forced:FORCED},{trimStart:trimStart,trimLeft:trimStart});var $trimEnd=stringTrim.end,FORCED$1=stringTrimForced("trimEnd"),trimEnd=FORCED$1?function(){return $trimEnd(this)}:"".trimEnd;_export({target:"String",proto:!0,forced:FORCED$1},{trimEnd:trimEnd,trimRight:trimEnd});var aPossiblePrototype=function(t){if(!isObject$1(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t},objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),e=r instanceof Array}catch(t){}return function(r,n){return anObject(r),aPossiblePrototype(n),e?t.call(r,n):r.__proto__=n,r}}():void 0),IteratorPrototype$2=iteratorsCore.IteratorPrototype,BUGGY_SAFARI_ITERATORS$1=iteratorsCore.BUGGY_SAFARI_ITERATORS,ITERATOR$1=wellKnownSymbol("iterator"),KEYS="keys",VALUES="values",ENTRIES="entries",returnThis$1=function(){return this},defineIterator=function(t,e,r,n,o,i,c){createIteratorConstructor(r,e,n);var a,s,u,l=function(t){if(t===o&&b)return b;if(!BUGGY_SAFARI_ITERATORS$1&&t in g)return g[t];switch(t){case KEYS:case VALUES:case ENTRIES:return function(){return new r(this,t)}}return function(){return new r(this)}},p=e+" Iterator",f=!1,g=t.prototype,h=g[ITERATOR$1]||g["@@iterator"]||o&&g[o],b=!BUGGY_SAFARI_ITERATORS$1&&h||l(o),d="Array"==e&&g.entries||h;if(d&&(a=objectGetPrototypeOf(d.call(new t)),IteratorPrototype$2!==Object.prototype&&a.next&&(objectGetPrototypeOf(a)!==IteratorPrototype$2&&(objectSetPrototypeOf?objectSetPrototypeOf(a,IteratorPrototype$2):"function"!=typeof a[ITERATOR$1]&&createNonEnumerableProperty(a,ITERATOR$1,returnThis$1)),setToStringTag(a,p,!0))),o==VALUES&&h&&h.name!==VALUES&&(f=!0,b=function(){return h.call(this)}),g[ITERATOR$1]!==b&&createNonEnumerableProperty(g,ITERATOR$1,b),o)if(s={values:l(VALUES),keys:i?b:l(KEYS),entries:l(ENTRIES)},c)for(u in s)!BUGGY_SAFARI_ITERATORS$1&&!f&&u in g||redefine(g,u,s[u]);else _export({target:e,proto:!0,forced:BUGGY_SAFARI_ITERATORS$1||f},s);return s},charAt$1=stringMultibyte.charAt,STRING_ITERATOR="String Iterator",setInternalState$1=internalState.set,getInternalState$1=internalState.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(t){setInternalState$1(this,{type:STRING_ITERATOR,string:String(t),index:0})}),(function(){var t,e=getInternalState$1(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=charAt$1(r,n),e.index+=t.length,{value:t,done:!1})}));var quot=/"/g,createHtml=function(t,e,r,n){var o=String(requireObjectCoercible(t)),i="<"+e;return""!==r&&(i+=" "+r+'="'+String(n).replace(quot,""")+'"'),i+">"+o+"</"+e+">"},stringHtmlForced=function(t){return fails((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}))};_export({target:"String",proto:!0,forced:stringHtmlForced("anchor")},{anchor:function(t){return createHtml(this,"a","name",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("big")},{big:function(){return createHtml(this,"big","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("blink")},{blink:function(){return createHtml(this,"blink","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("bold")},{bold:function(){return createHtml(this,"b","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("fixed")},{fixed:function(){return createHtml(this,"tt","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("fontcolor")},{fontcolor:function(t){return createHtml(this,"font","color",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("fontsize")},{fontsize:function(t){return createHtml(this,"font","size",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("italics")},{italics:function(){return createHtml(this,"i","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("link")},{link:function(t){return createHtml(this,"a","href",t)}}),_export({target:"String",proto:!0,forced:stringHtmlForced("small")},{small:function(){return createHtml(this,"small","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("strike")},{strike:function(){return createHtml(this,"strike","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("sub")},{sub:function(){return createHtml(this,"sub","","")}}),_export({target:"String",proto:!0,forced:stringHtmlForced("sup")},{sup:function(){return createHtml(this,"sup","","")}});var string=path.String,charAt$2=stringMultibyte.charAt;_export({target:"String",proto:!0},{at:function(t){return charAt$2(this,t)}});var codeAt$1=stringMultibyte.codeAt,charAt$3=stringMultibyte.charAt,STRING_ITERATOR$1="String Iterator",setInternalState$2=internalState.set,getInternalState$2=internalState.getterFor(STRING_ITERATOR$1),$StringIterator=createIteratorConstructor((function(t){setInternalState$2(this,{type:STRING_ITERATOR$1,string:t,index:0})}),"String",(function(){var t,e=getInternalState$2(this),r=e.string,n=e.index;return n>=r.length?{value:void 0,done:!0}:(t=charAt$3(r,n),e.index+=t.length,{value:{codePoint:codeAt$1(t,0),position:n},done:!1})}));_export({target:"String",proto:!0},{codePoints:function(){return new $StringIterator(String(requireObjectCoercible(this)))}});var REPLACE=wellKnownSymbol("replace"),RegExpPrototype$1=RegExp.prototype;_export({target:"String",proto:!0},{replaceAll:function t(e,r){var n,o,i,c,a,s,u,l=requireObjectCoercible(this);if(null!=e){if(isRegexp(e)&&!~String(requireObjectCoercible("flags"in RegExpPrototype$1?e.flags:regexpFlags.call(e))).indexOf("g"))throw TypeError("`.replaceAll` does not allow non-global regexes");if(void 0!==(n=e[REPLACE]))return n.call(e,l,r)}if(o=String(l),""===(i=String(e)))return t.call(o,/(?:)/g,r);if(c=o.split(i),"function"!=typeof r)return c.join(String(r));for(s=(a=c[0]).length,u=1;u<c.length;u++)a+=String(r(i,s,o)),s+=i.length+c[u].length,a+=c[u];return a}}),tnLineStdinReader().subscribe((function(t){var e=_toConsumableArray(t.matchAll(/AP+/g)).map((function(t){return t[0].length-1})).sort((function(t,e){return e-t})),r=e.length?e[0]:0;console.log(r)}));

var t = readline();
for(var n=0;n<t;n++){
    var k = readline();
    var s = readline();
    print(result(s));
}

function result(s){
    if(s===undefined){s="";}
    var arr=s.split("");
    var arr2=s.split("");
    var noChange=false;
    var time=-1;
    while(!noChange){
        noChange=true;
        for(var i=0;i<arr.length-1;i++){
            if(arr[i]==='A'&&arr[i+1]!=='A'){arr2[i+1]='A';noChange=false;}
        }
        time++;
        arr=arr2.slice();
    }//break while once no Changes
    return time;
}//result method

function myout(t){print(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main() {
  var t = myconv(readline(),1);
  var output = [];
  for(var i = 0; i < t; i++){
      var k = myconv(readline(),1);
      var list = myconv(readline(),6);
      var isA = false;
      var countP = 0;
      var maxP = 0;
      for(var j = 0; j < k; j++){
          if(!isA && list[j] == "P"){
              continue;
          }
          if(list[j] == "A"){
              isA = true;
              maxP = Math.max(maxP, countP);
              countP = 0;
          }else if(list[j] == "P"){
              countP++;
          }
      }
      maxP = Math.max(maxP, countP);
      output.push(maxP);
  }
  myout(output.join("\n"));
}

Main();

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var length = +readline();
    var str = readline();

    var ap = str
        .match(/AP+/g)

    if (ap) {
        print(
            ap.map(function(a) {
                return a.length
            })
            .sort(function(a, b) {
                return b - a
            })[0] - 1
        )
    } else {
        print(0)
    }
  }
}
main()

  var t = readline();
  while(t--){
    var n = readline();
    var str = readline();

    var result = 0,
      cnt = 0,
      sum = 0;

    for (var i = 0; i < n; i++) {
      if (str[i] === 'A') {
        cnt = 0;
        sum = 1;
      } else if (sum) {
        cnt++;
      }
      result = Math.max(result, cnt);
    }
    print(result);
  }

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    var posA = line.lastIndexOf('A');
    var posP = line.lastIndexOf('P');
    if (posA === num - 1) {
      console.log(0);
    } else if (posP > posA) {
      console.log(posP-posA);
    }
  } else if (T !== -1) {
    num = line;
  }
  T ++;
})

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
let T = -1;
let num = -1;
rl.on('line', (line) => {
  if (T !== -1 && T % 2) {
    var posA = line.lastIndexOf('A');
    var posP = line.lastIndexOf('P');
    if (posA === num - 1 || posA === -1) {
      console.log(0);
    } else if (posP > posA) {
      console.log(posP-posA);
    }
  } else if (T !== -1) {
    num = line;
  }
  T ++;
})

'use strict';

var readline = require('readline');

function _toConsumableArray(arr) {
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
}

function _arrayWithoutHoles(arr) {
  if (Array.isArray(arr)) {
    for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];

    return arr2;
  }
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance");
}

function tnLineStdinReader() {
  return new Promise(function (resolve) {
    var stdin = readline.createInterface(process.stdin);
    var output = [];
    var tests = null;
    var n = null;
    stdin.on('line', function (line) {
      if (tests === null) {
        tests = +line;
      } else if (n === null) {
        n = +line;
        tests--;
      } else if (tests > 0) {
        n = null;
        output.push(line);
      } else {
        output.push(line);
        stdin.close();
        resolve(output);
      }
    });
  });
}

tnLineStdinReader().then(function (tests) {
  tests.forEach(function (t) {
    var allGroups = _toConsumableArray(t.matchAll(/AP+/g)).map(function (match) {
      return match[0].length - 1;
    }).sort(function (a, b) {
      return b - a;
    });

    var maxLength = allGroups.length ? allGroups[0] : 0;
    console.log(maxLength);
  });
});

var queries = parseInt(readline());
for(var i = 0; i < queries ;i++){
var discard = readline();
var myStr = readline();
var result = myStr.split('').reduce((sum,val,index,arr)=>{
    if (arr[index-1] == 'A' && arr[index] == 'P'){
      return sum += 1;
    }
  else{
    return sum;
  }
},0);
print(result);
}

var t;
t=readline();
while (t--){
    var ans=0; var pos=-1,str,n;
    n=readline();
    str=readline();
    for (var i=0; i<n; i++){
        if (str[i]=='P'){
            if (pos!=-1)
                ans=Math.max (ans, i-pos);
            else
            pos=i;
        }
    }
     print (ans);
}


var fs = require("fs");
var stdinBuffer = fs.readFileSync(0); // STDIN_FILENO = 0

const lines = stdinBuffer.toString().match(/[^\r\n]+/g).slice(1);

const examples = [];

for(let i = 0; i < lines.length; i+=2) {
    examples.push(lines[i+1].split(' ').map(x => parseInt(x, 10)));
}

const solver = (arr) => {
    let currentMaxResult = 0;

    for (let l = 0; l < arr.length - 1; l++) {
        const result = Math.max(arr[l], arr[l+1]) * Math.min(arr[l], arr[l+1])
        if (result > currentMaxResult) {
            currentMaxResult = result;
        }
    }
    // for(let l = 0; l < arr.length; l++) {
    //     let max = arr[l];
    //     let min = arr[l];
    //     for(let r = l + 1; r < arr.length; r++) {

    //         if (arr[r] > max)
    //         max = Math.max(arr[r], max);
    //         min = Math.min(arr[r], min);
    //         const result = min*max;
    //         if (result > currentMaxResult) {
    //             currentMaxResult = result;
    //             // console.log({subArr})
    //         }
    //     }
    // }

    return currentMaxResult;
};

for(let example of examples) {
    console.log(solver(example))
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
	var e = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            e = lines[i];
        }else{
            var k = lines[i].split(' ');
            var b = k[0];
            var max = 0;
            for(j = 1; j < e; j++){
                var a = b * k[j];
                if(a > max){
                    max = a;
                }
                b = k[j];
            }
            console.log(max);
        }
    }
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
	var t = lines[0];
    var n = 0;
    for(i = 1; i <= t * 2; i++){
        if(i % 2 == 1){
            n = lines[i];
        }else{
            var k = lines[i].split(' ').map(Number);
            var a = k[0]; var c = 0; var max = -1;
            for(j = 1; j < n; j++){
                c = a * k[j];
                if(c > max){
                    max = c;
                }
                a = k[j];
            }
            console.log(max);
        }
    }
});

const fs = require('fs');

const input = String(fs.readFileSync(0))
  .split('\n')
  .filter(Boolean)
  .map((str) => str.trim());

for (let i = 2; i < input.length; i += 2) {
  const arr = input[i].split(' ').map((s) => parseInt(s));
  console.log(solve(arr));
}

function solve(arr) {
  let max = 0;

  for (let i = 0; i < arr.length - 1; i++) {
    const prod = arr[i] * arr[i + 1];

    if (prod > max) {
      max = prod;
    }
  }

  return max;
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
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 = +lines[l++]
        const args = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, args))
    }
// })()
})

function solve(n, arr) {
    let max = -1
    arr.forEach((x, i) => {
        if (i + 1 < n) {
            max = Math.max(max, x * arr[i + 1])
        }
        if (i - 1 >= 0) {
            max = Math.max(max, x * arr[i - 1])
        }
    })
    return max
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
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 = +lines[l++]
        const args = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, args))
    }
// })()
})

function solve(n, arr) {
    const max = Math.max(...arr)
    let m2 = -1
    arr.some((x, i) => {
        if (x < max) return false

        if (i + 1 < n) {
            m2 = Math.max(m2, arr[i + 1])
        }
        if (i - 1 >= 0) {
            m2 = Math.max(m2, arr[i - 1])
        }

        // let second = -1
        // let min = Infinity
        // for (let j = i + 1; j < n; j++) {
        //     min = Math.min(min, arr[j])
        //     second = Math.max(min, second)
        //     console.log('sb', arr[j], min, second)
        //     if (second === max) {
        //         m2 = second
        //         return true
        //     }
        // }
        // min = Infinity
        // for (let j = i - 1; j >= 0; j--) {
        //     min = Math.min(min, arr[j])
        //     second = Math.max(min, second)
        //     console.log('sb', arr[j], min, second)
        //     if (second === max) {
        //         m2 = second
        //         return true
        //     }
        // }
        // m2 = Math.max(m2, second)
    })
    return max * m2
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
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 = +lines[l++]
        const args = lines[l++].trim().split(' ').map(Number)
        console.log(solve(n, args))
    }
// })()
})

function solve(n, arr) {
    const max = Math.max(...arr)
    let m2 = -1
    arr.some((x, i) => {
        if (x < max) return false
        let second = -1
        let min = Infinity
        for (let j = i + 1; j < n; j++) {
            min = Math.min(min, arr[j])
            second = Math.max(min, second)
            if (second === max) {
                m2 = second
                return true
            }
        }
        min = Infinity
        for (let j = i - 1; j >= 0; j--) {
            min = Math.min(min, arr[j])
            second = Math.max(min, second)
            if (second === max) {
                m2 = second
                return true
            }
        }
        m2 = Math.max(m2, second)
    })
    return max * m2
}


var lt = function(a, b) {
    if (a[0] < b[0]) {
        return true;
    }
    if (a[0] == b[0] && a[1] > b[1]) {
        return true;
    }
    return false;
}

var eq = function(a, b) {
    return (a[0] == b[0] && a[1] == b[1]);
}

var lower_bound = function(A, x) {
    var l = 0;
    var r = A.length - 1;

    while (l <= r) {
        var m = Math.floor((l+r) / 2);
        if (lt(x, A[m])) {
            l = m + 1;
        }
        else {
            r = m - 1;
        }
    }
    return l;
}

var upper_bound = function(A, x) {
    var l = 0;
    var r = A.length - 1;

    while (l <= r) {
        var m = Math.floor((l+r) / 2);
        if (lt(x, A[m]) || eq(x, A[m])) {
            l = m + 1;
        }
        else {
            r = m - 1;
        }
    }
    return l;
}

var main = function(n, k) {
    var s = [];
    for (var i = 0; i < n; i++) {
        s.push(readline().split(' ').map(Number));
    }
    s.sort(function(a, b) {
        if (lt(a, b)) {
            return -1;
        }
        if (eq(a, b)) {
            return 0;
        }
        return 1;
    });
    s.reverse();
    print(upper_bound(s, s[k-1]) - lower_bound(s, s[k-1]));
}

main.apply(0, readline().split(' ').map(Number));

var l=readline().split(' ');
var n=+l[0];
var k=+l[1]-1;
var a=[];
for(var i=0;i<n;i++){
	a.push(readline().split(' ').map(function(v){return+v;}));
}
a.sort(function(a,b){
	if(a[0]===b[0]){
		return a[1]-b[1];
	}else{
		return b[0]-a[0];
	}
});
var ans=0;
for(var i=0; i<n; i++){
	if(a[i][0]===a[k][0]&&a[i][1]===a[k][1]){
		ans++;
	}
}
print(ans);

;(function () {

	var n = readline().split(' ');
	var k = +n[1];
	n = +n[0];

	var v = [];
	for (var i = 0; i < n; i++) v.push(readline().split(' ').map(Number).reduce(function (a, b) { return (a + 1) * 100 - b }));
	v = v.sort(function (a, b) { return b - a; });

	var t = v[k - 1];
	print(v.filter(function (e) { return e === t; }).length);

}).call(this);

var input = readline().split(' ').map(Number);

var n = input[0];
var k = input[1];

var teams = [];

for (var i = 0; i < n ; i++) {
	var team = readline().split(' ').map(Number);
	teams[i] = {p: team[0], t: team[1]};
}

teams[n] = {p: 0, t: 51};

var f = function(ti, tj) {
	if (tj.p - ti.p === 0) {
		return ti.t - tj.t;
	} else {
		return tj.p - ti.p;
	}
}

teams.sort(f);

var same_place = 1;
var current_place = 1;
var output = 0;

for (var j = 0; j < n; j++) {

	while (f(teams[j], teams[j + 1]) === 0) {
		same_place += 1;
		current_place += 1;
		j++;
	}

	if (current_place < k) {
		same_place = 1;
		current_place += 1;
	} else {
		output = same_place;
		break;
	}
}

print(output);

var l=readline().split(' ');
var n=+l[0];
var k=+l[1]-1;
var a=[];
for(var i=0;i<n;i++){
	a.push(readline().split(' ').map(function(v){return+v;}));
}
a.sort(function(a,b){
	if(a[0]===b[0]){
		return b[1]-a[1];
	}else{
		return b[0]-a[0];
	}
});
var ans=0;
for(var i=0; i<n; i++){
	if(a[i][0]===a[k][0]&&a[i][1]===a[k][1]){
		ans++;
	}
}
print(ans);

;(function () {

	var n = readline().split(' ');
	var k = +n[1];
	n = +n[0];

	var v = [];
	for (var i = 0; i < n; i++) v.push(readline().split(' ').map(Number).reduce(function (a, b) { return a * 100 + b }));
	v = v.sort(function (a, b) { return b - a; });

	var t = v[k - 1];
	print(v.filter(function (e) { return e === t; }).length);

}).call(this);


var l=readline().split(' ');
var n=+l[0];
var k=+l[1];

var ans=-1e9;

while(n--){
	var l=readline().split(' ').map(function(v){return+v})
	var c=l[1]-k;
	c=c>0?l[0]-c:l[0];
	ans=Math.max(c,ans);
}
print(ans);

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, k;
let joy = -Infinity;

rl.on('line', (d) => {
  if (c === 0) {
    [n, k] = d.split(' ').map(Number);
    c++;
    return;
  }

  const [f, t] = d.split(' ').map(Number);
  joy = Math.max(joy, f - Math.max(t - k, 0));

  c++;
});

rl.on('close', () => {
  console.log(joy);
});

var input = readline().split(" "), n = +input[0], k = +input[1];
var max = -Infinity, p;

for(i = 0; i < n; i++){
	input = readline().split(" ").map(Number)
	f = input[0];
	t = input[1];

	p = (t > k) ? (f - t + k) : f;

	max = Math.max(max, p);
}

write(max);

function main(n,k,arr){

    var max = -Infinity;

    for(var i = 0 ; i < n ; i++){

      if(parseInt(arr[i][1]) > k){
        max = Math.max(max,(parseInt(arr[i][0])-parseInt(arr[i][1]-k)))
      }
      else{
        max = Math.max(max,parseInt(arr[i][0]));
       }
    }

    print(max);

}

var nk = readline().split(" ");
for(var i = 0 ; i < nk.length ; i++)nk[i] = parseInt(nk[i]);

var arr = [];
for(var i = 0 ; i < nk[0] ; i++){
  arr[i] = readline().split(" ");
}

main(nk[0],nk[1],arr)

;(function () {

	var n = readline().split(' ');
	var k = +n[1];
	n = +n[0];

	var x = [], f, t;
	for (var i = 0; i < n; i++) {
		f = readline().split(' ').map(Number);
		t = f[1]; f = f[0];

		x.push( t > k ? f -(t-k) : f );
	}

	print( Math.max.apply(null, x) );

}).call(this)

var tok = null;
var index = 0;
function next() {
    while (tok == null || index == tok.length) {
        tok = readline().split(' ');
        index = 0;
    }
    var res = tok[index++];
    return res;
}

function nextInt() {
    return parseInt(next());
}

function sortNumber(a, b) {
    return a - b;
}

function reverse(s) {
    var rS = "";
    for (var i = 0; i < s.length; i++) {
        rS += s.charAt(s.length - 1 - i);
    }
    return rS;
}

function main() {
    var n = nextInt();
    var k = nextInt();
    var f = nextInt();
    var t = nextInt();
    var joy = f;
    if (t > k) {
        joy = f - t + k;
    }
    var max = joy;
    for (var i = 1; i < n; i++) {
        f = nextInt();
        t = nextInt();
        joy = f;
        if (t > k) {
            joy = f - t + k;
        }
        if (joy > max) {
            max = joy;
        }
    }
    print(max);
}

main();

// 276A     Проблемные обеды

// var n = parseInt(readline());

var input_line = readline().split(' ').map(Number);

var n = input_line[0];
var k = input_line[1];

var max = - 1000000000;
var arr = [];
var f;

for (var i = 0; i < n; i++) {
    arr = readline().split(' ').map(Number);

    if (arr[1] > k) {
        f = arr[0] - (arr[1] - k);
    } else {
        f = arr[0];
    };

    if (max < f) max = f;
};

print(max);

let inpStr = "";

function calcJoy(maxTime, joyEarned, timeTaken) {
    if (timeTaken > maxTime) return joyEarned - (timeTaken - maxTime);
    else return joyEarned;

}

process.stdin.addListener("data", data => {//For big amts of inp, it is passed in as multiple smaller chunks, so it must be aggregated
    inpStr += data.toString();
});

process.stdin.addListener("end", data => {//Once all data is recieved, do the calculations
    const splitData = inpStr.split(/[\r\n]+/);
    const params = splitData.splice(0, 1)[0].split(" ").map(n => parseInt(n));
    const restaurants = splitData.map(n => n.split(" ").map(n => parseInt(n)));

    let best = -Infinity;
    for (let restaurant of restaurants) {
        const joy = calcJoy(params[1], restaurant[0], restaurant[1]);
        if (joy > best) best = joy;
    }
    console.log(best);
});

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let n, k;
let joy = -Infinity;

rl.on('line', (d) => {
  if (c === 0) {
    [n, k] = d.split(' ').map(Number);
    c++;
    return;
  }

  const [f, t] = d.split(' ').map(Number);

  if (k >= t) {
    joy = Math.max(joy, f);
  }
  else {
    joy = Math.max(joy, f - (t - k));
  }

  c++;
});

rl.on('close', () => {
  console.log(joy);
});

function calcJoy(maxTime, joyEarned, timeTaken) {
    if (timeTaken > maxTime) return joyEarned - (timeTaken - maxTime);
     else return joyEarned;

}

process.stdin.addListener("data", data => {
    const splitData = data.toString().split(/[\r\n]+/);
    const params = splitData.splice(0, 1)[0].split(" ").map(n => parseInt(n));
    const restaurants = splitData.map(n => n.split(" ").map(n => parseInt(n)));

    let best = -Infinity;
    for (let restaurant of restaurants) {
        const joy = calcJoy(params[1], restaurant[0], restaurant[1]);
        if (joy > best) best = joy;
    }
    console.log(best);
});

var l=readline().split(' ');
var n=+l[0];
var k=+l[1];

var ans=-1e9;
print(ans)

while(n--){
	var l=readline().split(' ').map(function(v){return+v})
	var c=l[1]-k;
	c=c>0?l[0]-c:l[0];
	ans=Math.max(c,ans);
}
print(ans);