title: String of n length in java
body: <pre><code>public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
      int N=sc.nextInt();
      String s="";
      for(int i=0;i&lt;N;i++){
         s=sc.nextLine();
      }
  </code></pre>
  
  <p>Eg : N= 10
  S = aabbbabbab</p>
  
  <p>How do I take an input of String of n length ?
  I am trying to take an input String which must be of length N.
  I know the above logic is wrong, but still i am confused ?
  PS: The first line of input contains a single integer N − the length of the string. 
  The second line contains the initial string S itself. </p>