Skip to main content

Posts

Showing posts with the label Addition ain't simple

Java 8 coding challenge: Addition ain't simple

Jack is awesome. His friends call him little Einstein. To test him, his friends gave him a string. They told him to add the string with its reverse string and follow these rules: Every  i th  character of string will be added to every  i th  character of reverse string. Both string will contain only lower case alphabets(a-z). Eg:- a+a=b,a+c=d,z+a=a (Refer to sample test cases for more details) Input: First line contains a value  N  denoting number of test cases. Next  N  lines contains string  str . Output: For every string  str  output the string that Jack's friends wants from him. Constraints 1 <= N <= 10 1 <= str <= 10^5 SAMPLE INPUT     4 hello codeapocalypse programming world SAMPLE OUTPUT     wqxqw hhtdmqrrqmdthh wfxtebetxfw aajaa Code: import java.io.*; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; p...

Java 8 coding challenge: Addition ain't simple

Jack is awesome. His friends call him little Einstein. To test him, his friends gave him a string. They told him to add the string with its reverse string and follow these rules: Every i th character of string will be added to every i th character of reverse string. Both string will contain only lower case alphabets(a-z). Eg:- a+a=b,a+c=d,z+a=a (Refer to sample test cases for more details) Input: First line contains a value N denoting number of test cases. Next N lines contains string str . Output: For every string str output the string that Jack's friends wants from him. Constraints 1 <= N <= 10 1 <= str <= 10^5 SAMPLE INPUT 4 hello codeapocalypse programming world SAMPLE OUTPUT wqxqw hhtdmqrrqmdthh wfxtebetxfw aajaa Code: import java.io.*; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; public class AdditionAintSimple { static class Print { private final BufferedWriter bw; public Print() { this.bw = new Buffere...