@@ -0,0 +1,838 @@
+//https://www.hackerrank.com/challenges/cipher%0Aimport java.io.*;%0A%0Apublic class Solution %7B%0A  public static void main(String%5B%5D args) throws IOException %7B%0A    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0A    %0A    //Get input%0A    String%5B%5D line = br.readLine().split(%22 %22);%0A    int N = Integer.parseInt(line%5B0%5D);%0A    int K = Integer.parseInt(line%5B1%5D);%0A    char%5B%5D S = br.readLine().toCharArray();%0A    %0A    //Limit K%0A    if(K %3E N)%7B%0A      K = N;%0A    %7D%0A    %0A    //Decode%0A    char%5B%5D C = new char%5BN%5D;%0A    C%5B0%5D = S%5B0%5D;%0A    for(int i = 1; i %3C K; ++i)%7B%0A      C%5Bi%5D = xor(S%5Bi%5D, S%5Bi-1%5D);%0A    %7D%0A    for(int i = K; i %3C N; ++i)%7B%0A      C%5Bi%5D = xor(xor(S%5Bi%5D, S%5Bi-1%5D), C%5Bi-K%5D);%0A    %7D%0A    %0A    //Print output%0A    System.out.print(C);%0A  %7D%0A  %0A  private static char xor(final char a, final char b)%7B%0A    return (a == b) ? '0' : '1';%0A  %7D%0A%7D%0A

Create cipher.java