Given an integer $$$n$$$, find the maximum value of integer $$$k$$$ such that the following condition holds:  $$$n$$$ & ($$$n-1$$$) & ($$$n-2$$$) & ($$$n-3$$$) & ... ($$$k$$$) = $$$0$$$  where & denotes the bitwise AND operation.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3 \cdot 10^4$$$). Then $$$t$$$ test cases follow. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^9$$$).

For each test case, output a single integer — the required integer $$$k$$$.

NoteIn the first testcase, the maximum value for which the continuous & operation gives 0 value, is 1.In the second testcase, the maximum value for which the continuous & operation gives 0 value, is 3. No value greater then 3, say for example 4, will give the & sum 0.   $$$5 \, \& \, 4 \neq 0$$$,  $$$5 \, \& \, 4 \, \& \, 3 = 0$$$. Hence, 3 is the answer.

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg10 = Math.log10;
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => JSON.stringify(a) == JSON.stringify(b);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

let d = [1, 0];
const solve = () => {
    for (let i = 2; 2 ** i <= 536870912; i++) {
        d.unshift(2 ** i - 1);
    }
    // pr(d);
};

const go = (x) => {
    let n = d.length;
    for (let i = 0; i < n; i++) {
        if (x > d[i]) return pr(d[i]);
    }
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(Number(line));
    });
    rl.on('close', () => {
        solve();
        let t = input[0];
        let i = 1;
        while (t--) {
            go(input[i]);
            i++;
        }
    });
};

main()

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	let t = nl.num();
    let list = [];
    for (let i = 0; i < t; i++){
        list.push(nl.num());
    }
    let bitSize = (n) => {
        let cnt = 0;
        while(n > 1) {
            n >>= 1;
            cnt++;
        }
        return cnt;
    }
    let bitMax = (n) => {
        let max = 1;
        for(let i = 0; i < n; i++){
            max <<= 1;
        }
        return max - 1;
    }

	console.log(list.map(bitSize).map(bitMax).join('\n'));

};

process.stdin.on('end', sol);

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	let t = nl.num();
    let bitSize = (n) => {
        let cnt = 0;
        while(n > 1) {
            n >>= 1;
            cnt++;
        }
        return cnt;
    }
    let bitMax = (n) => {
        let max = 1;
        for(let i = 0; i < n; i++){
            max <<= 1;
        }
        return max - 1;
    }
    let ans = [];
    for(let i = 0; i < t; i++) {
        let n = nl.num();
        ans.push(bitMax(bitSize(n)));
    }
	console.log(ans.join('\n'));

};

process.stdin.on('end', sol);

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        console.log(solve());
    }
}
function solve() {
    let n = parseInt(readLine()), last = 0;
    for (let i = 0; i < 30; ++i) {
        if (((n >> i) & 1) == 1) {
            last = i;
        }
    }
    return (1 << last) - 1;
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var k = lines[j];
        var answer = 0;
        var last = 0;
        while(k > answer){
            last = answer;
            answer = (2 * answer) + 1;
        }
        console.log(last);
    }
});

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 t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        var n = +lines[l++]
        console.log(solve(n));
    }
});

function solve(n) {
	const base = Math.floor(Math.log2(n))
	return Math.pow(2, base) - 1
}

'use-strict'

process.stdin.resume();
process.stdin.setEncoding('utf8');

let data = '';
let currentLine = 0;

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

process.stdin.on('end', () =>{
    data = data.replace(/\s*$/, '')
    .split('\n')
    .map(str => str.replace(/\s*$/, ''));

        let testCases = parseInt(readLine());
        while(testCases--)
            print(Math.pow(2,parseInt(Math.log(parseInt(readLine())) / Math.log(2), 10)) - 1)

});

function print(c){
    return console.log(c);
}

function get_ints() {
    return readLine().split(' ').map(Number)
}

function readLine() {
        return data[currentLine++];
}

//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 tmp = "";
		while(N > 0){
			tmp = N % 2 + tmp;
			N = Math.floor(N / 2);
		}
		var output = Math.pow(2, tmp.length - 1) - 1;
		myout(output);
	}
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var t = Number(input[0]);
    l=1;
    for(var i=0;i<t;i++){
        var n = Number(input[l++]);

    var ans=0;
    var res=0;
    var cnt=0;
    while(res<=n){
        ans=res;
        res=Math.pow(2,cnt);
        cnt++;
    }
    console.log(ans-1);
    }

});

var tc=readline();
while(tc--)
{
 var n=readline();n=Number(n);
 var u=Math.log2(n)+1;
 u=Math.floor(u);
 print(Math.pow(2,u-1)-1);
 }

const cases = readline()
var bit = []
for (var i = 0; i < cases; i++) {
    bit[i] = readline()
}
var i = 0
while (i < bit.length) {
    var res = bit[i]
    var last = 0
    for(var j=0; j<30; ++j) {
        if ((res >> j)& 1 === 1) {
            last = j
        }
    }
    print((1<<last)-1)
    i++
}

var t = parseInt(readline());

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

  while ((n & (n - 1)) > 0) {
    n = n & (n - 1);
  }

  print(n - 1);
}

var e=readline();
for(var i=0;i<e;i++){
  var n=parseInt(readline());
  var r=1;
  while(n>1){
    r=r<<1;
    n=n>>1;
  }
  print(r-1);
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg10 = Math.log10;
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => JSON.stringify(a) == JSON.stringify(b);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (n) => {
    if (n == 1) return pr(0);
    pr(n & 1 ? n - 2 : n - 1)
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(Number(line));
    });
    rl.on('close', () => {
        let t = input[0];
        let i = 1;
        while (t--) {
            solve(input[i]);
            i++;
        }
    });
};

main()

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg10 = Math.log10;
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => JSON.stringify(a) == JSON.stringify(b);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (n) => {
    pr(n & 1 ? n - 2 : n - 1)
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(Number(line));
    });
    rl.on('close', () => {
        let t = input[0];
        let i = 1;
        while (t--) {
            solve(input[i]);
            i++;
        }
    });
};

main()

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});
function readLine() {
    return inputString[currentLine++];
};
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
    // cmd(not powershell): node cp.js < input.txt
});

function main() {
    let t = parseInt(readLine());
    while (t-- > 0) {
        console.log(solve());
    }
}
function solve() {
    let num = temp = parseInt(readLine());
    for (let i = 1; i <= temp; i++) {
        num = num & (num - i);
        if (num === 0) {
            return temp-i;
        }
    }
}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var k = lines[j];
        //console.log(2 + ' ' + (k - 1));
    }
    console.log(1 + "\n" + 3 + "\n" + 15)
});

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 t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        var n = +lines[l++]
        console.log('Case #%d: %s', i + 1, solve(n));
    }
});

function solve(n) {
	const base = Math.floor(Math.log2(n))
	return Math.pow(2, base) - 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 tmp = "";
		while(N > 0){
			tmp = N % 2 + tmp;
			N = Math.floor(N / 2);
		}
		//myerr(tmp);
		var ok = "";
		var isOK = true;
		for(var i = 0; i < tmp.length; i++){
			if(!isOK){
				ok += "1";
				continue;
			}
			if(tmp[i] == "1"){
				ok += "0";
			}else{
				ok += "1";
				isOK = false;
			}
		}
		var output = parseInt(ok, 2);
		myout(output);
	}
}

var tc=readline();
while(tc--)
{
 var n=readline();n=Number(n);
  var ans;
  for(var i=0;i<32;i++)
  {
      var u=Math.pow(2,i);
    if(u-1<=n)
       ans=u-1;
    else break;
  }
   if(n==1) print(0);
 else print(ans);
}

var tc=readline();
while(tc--)
{
 var n=readline();n=Number(n);
  var ans;
  for(var i=0;i<32;i++)
  {
      var u=Math.pow(2,i);
    if(u-1<=n)
       ans=u-1;
    else break;
  }
  print(ans);
}

var tc=readline();
while(tc--)
{
 var n=readline();
  var a=n;var k=0;
  while(n)
{
      n=(n&(a-1));
      k++;
     a--;
    if(n==0)
    {
     print(k);
    break;
    }

}
}


The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.The Berland capital's map is represented by an n × m rectangular table. Each cell of the table on the map represents some districts of the capital. The capital's main detective Polycarpus took a map and marked there the districts where the first three robberies had been committed as asterisks. Deduction tells Polycarpus that the fourth robbery will be committed in such district, that all four robbed districts will form the vertices of some rectangle, parallel to the sides of the map. Polycarpus is good at deduction but he's hopeless at math. So he asked you to find the district where the fourth robbery will be committed.

The first line contains two space-separated integers n and m (2 ≤ n, m ≤ 100) — the number of rows and columns in the table, correspondingly. Each of the next n lines contains m characters — the description of the capital's map. Each character can either be a "." (dot), or an "*" (asterisk). A character equals "*" if the corresponding district has been robbed. Otherwise, it equals ".". It is guaranteed that the map has exactly three characters "*" and we can always find the fourth district that meets the problem requirements.

Print two integers — the number of the row and the number of the column of the city district that is the fourth one to be robbed. The rows are numbered starting from one from top to bottom and the columns are numbered starting from one from left to right.

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

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

  matrix.push([...d]);

  c++;
});

rl.on('close', () => {
  const points = [];
  let y, x;
  let sameLine;

  for (let i = 0; i < matrix.length; i++) {
    let pointsCount = 0;
    for (let j = 0; j < matrix[i].length; j++) {
      if (matrix[i][j] === '*') {
        points.push([i, j]);
        pointsCount++;
      }
    }

    if (pointsCount === 1) {
      y = points[points.length - 1][0] + 1;
      sameLine = points[points.length - 1];
    }
  }

  for (let i = 0; i < points.length; i++) {
    if (sameLine[1] !== points[i][1]) {
      x = points[i][1] + 1;
      break;
    }
  }

  console.log(`${y} ${x}`);
});


One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane n rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Rectangles cannot intersect, but they can touch each other.Help Timofey to color his rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color, or determine that it is impossible.Two rectangles intersect if their intersection has positive area. Two rectangles touch by sides if there is a pair of sides such that their intersection has non-zero length    The picture corresponds to the first example

The first line contains single integer n (1 ≤ n ≤ 5·105) — the number of rectangles. n lines follow. The i-th of these lines contains four integers x1, y1, x2 and y2 ( - 109 ≤ x1 < x2 ≤ 109,  - 109 ≤ y1 < y2 ≤ 109), that means that points (x1, y1) and (x2, y2) are the coordinates of two opposite corners of the i-th rectangle. It is guaranteed, that all sides of the rectangles have odd lengths and rectangles don't intersect each other.

Print "NO" in the only line if it is impossible to color the rectangles in 4 different colors in such a way that every two rectangles touching each other by side would have different color. Otherwise, print "YES" in the first line. Then print n lines, in the i-th of them print single integer ci (1 ≤ ci ≤ 4) — the color of i-th rectangle.

function main() {
    var all = [[2,1], [3,4]]
    var n = Number(readline());
    print("YES");
    for(var i=0;i<n;i++){
        var line = readline().split(' ').map(Number);
        var x = Math.abs(line[0]);
        var y = Math.abs(line[1]);
        print(all[x%2][y%2]);
    }

}

main()


Given a string $$$s$$$ of length $$$n$$$ and integer $$$k$$$ ($$$1 \le k \le n$$$). The string $$$s$$$ has a level $$$x$$$, if $$$x$$$ is largest non-negative integer, such that it's possible to find in $$$s$$$:  $$$x$$$ non-intersecting (non-overlapping) substrings of length $$$k$$$,  all characters of these $$$x$$$ substrings are the same (i.e. each substring contains only one distinct character and this character is the same for all the substrings). A substring is a sequence of consecutive (adjacent) characters, it is defined by two integers $$$i$$$ and $$$j$$$ ($$$1 \le i \le j \le n$$$), denoted as $$$s[i \dots j]$$$ = "$$$s_{i}s_{i+1} \dots s_{j}$$$".For example, if $$$k = 2$$$, then:  the string "aabb" has level $$$1$$$ (you can select substring "aa"),  the strings "zzzz" and "zzbzz" has level $$$2$$$ (you can select two non-intersecting substrings "zz" in each of them),  the strings "abed" and "aca" have level $$$0$$$ (you can't find at least one substring of the length $$$k=2$$$ containing the only distinct character). Zuhair gave you the integer $$$k$$$ and the string $$$s$$$ of length $$$n$$$. You need to find $$$x$$$, the level of the string $$$s$$$.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 2 \cdot 10^5$$$) — the length of the string and the value of $$$k$$$. The second line contains the string $$$s$$$ of length $$$n$$$ consisting only of lowercase Latin letters.

Print a single integer $$$x$$$ — the level of the string.

NoteIn the first example, we can select $$$2$$$ non-intersecting substrings consisting of letter 'a': "(aa)ac(aa)bb", so the level is $$$2$$$.In the second example, we can select either substring "a" or "b" to get the answer $$$1$$$.

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

let l = 0;
let x = 0
let k = 0
let n = 0
rl.on('line', (input) => {
    if (l === 0) {
        let arr = input.split(" ").map(x => parseInt(x))
        x = arr[0]
        k = arr[1]
    } else {
        rl.close();
        let hm = {}
        let arr = input.split("")
        let c = 0
        for (let i = 0; i < arr.length; i++) {
            let cnt = 1
            let st = i
            while (i + 1 < arr.length && arr[i] === arr[i + 1] && cnt < k) {
                cnt++
                i++
            }
            if (hm[arr[i]] && cnt === k) {
                hm[arr[i]]++
            } else if (cnt === k) {
                hm[arr[i]] = 1
            }
        }

        let mn = 0
        for (let e in hm) {
            if (mn < hm[e]) {
                mn = hm[e]
            }
        }
        console.log(mn)
        return
    }
    l++
})

function ansb(n,k,str){

  const obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.keys(obj).map(function(key){ return obj[key]});
  var max = Math.max(...arr);
  print(max === -Infinity ? 0 : max);
}

var line = readline().split(' ')
var str = readline()
ansb(parseInt(line[0]),parseInt(line[1]),str);

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

let l = 0;
let x = 0
let k = 0
let n = 0
rl.on('line', (input) => {
    if (l === 0) {
        let arr = input.split(" ").map(x => parseInt(x))
        x = arr[0]
        k = arr[1]
    } else {
        rl.close();
        let hm = {}
        let arr = input.split("")
        let c = 0
        for (let i = 0; i < arr.length - 1; i++) {
            let cnt = 1
            let st = i
            while (arr[i] === arr[i + 1] && cnt < k) {
                cnt++
                i++
            }
            if (hm[arr[i]] && cnt === k) {
                hm[arr[i]]++
            } else if (cnt === k) {
                hm[arr[i]] = 1
            }
        }

        let mn = 0
        for (let e in hm) {
            if (mn < hm[e]) {
                mn = hm[e]
            }
        }
        if (mn === 0 && k === 1) {
            console.log(1)
            return
        }
        console.log(mn)
        return
    }
    l++
})

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

let l = 0;
let x = 0
let k = 0
let n = 0
rl.on('line', (input) => {
    if (l === 0) {
        let arr = input.split(" ").map(x => parseInt(x))
        x = arr[0]
        k = arr[1]
    } else {
        rl.close();
        let hm = {}
        let arr = input.split("")
        let c = 0
        for (let i = 0; i < arr.length - 1; i++) {
            let cnt = 1
            let st = i
            while (arr[i] === arr[i + 1] && cnt < k) {
                cnt++
                i++
            }
            if (hm[arr[i]] && cnt == k) {
                hm[arr[i]]++
            } else if (cnt === k) {
                hm[arr[i]] = 1
            }
        }
        let mn = 0
        for (let e in hm) {
            if (mn < hm[e]) {
                mn = hm[e]
            }
        }
        console.log(mn)
        return
    }
    l++
})

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var input = readline().split(',');
print(input[1])

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var input = readline().split(' ');
print(input)

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var input = readline().split('/n');
print(input[1])

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var line = readline().split(' ')
print(parseInt(line[0]) + parseInt(line[1]))

function ansb(n,k,str){

  var obj = []

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var max = Math.max(...obj);
  print(max === -Infinity ? 0 : max);
}

var line = readline().split(' ')
var str = readline()
ansb(parseInt(line[0]),parseInt(line[1]),str);

function ansb(n,k,str){

  const obj = []

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var max = Math.max(...obj);
  print(max === -Infinity ? 0 : max);
}

var line = readline().split(' ')
var str = readline()
ansb(parseInt(line[0]),parseInt(line[1]),str);

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var input = readline().split(',');
print(input[0])

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var line = readline().split(' ')
var line2 = readline()
print(parseInt(line[0]) + parseInt(line[1]))
print(line2)

function ansb(n,k,str){

  var obj = {}

  for(var i = 0 ; i < str.length ; i++){

    var cnt = 1;
    while(str[i+1] === str[i] && i+1 !== str.length){
      cnt++;
      i++
      // console.log("here")
      // console.log(cnt)
    }
    if(cnt >= k)obj[str[i]] ? obj[str[i]] += Math.floor(cnt/k) : obj[str[i]] = Math.floor(cnt/k);
  }
  var arr = Object.values(obj);
  var max = Math.max(...arr);
  console.log(max === -Infinity ? 0 : max);
}

var input = readline().split('/n');
print(input)