Skip to main content

Posts

Showing posts from January, 2018

Read different types of data from standard input, process them as shown in output format and print the answer to standard output.

/* Problem Statement: Read different types of data from standard input, process them as shown in output format and print the answer to standard output. Input format: First line contains integer N. Second line contains string S. Output format: First line should contain N x 2. Second line should contain the same string S. Constraints: 0≤N≤10 1≤|S|≤15 where |S|= length of string S  */ import java.util.Scanner; public class TestClass {      public static void main(String[] args) {         Scanner sc = new Scanner(System.in);         int number = 0;         String string = null;         int firstInput = sc.nextInt();         String secondInput = sc.next();         // apply constraints         if (firstInput >= 0 && firstInput <= 1...