/* File: Underscore.java */

/* 
   Scrivere un metodo che data un stringa s restituisca la stringa
   ottenuta da s sostituiendo gli spazi bianchi con underscore ('_') 
*/

import java.io.*;
public class Underscore {
  
  public static String underscore(String s) {   
    if (s.equals("")) return "";
    else if (s.charAt(0)==' ') 
      return "_" + underscore(s.substring(1));
    else return s.substring(0,1) + underscore(s.substring(1));
  }
  



  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(
      new InputStreamReader(System.in));
    System.out.println("Inserire una stringa");
    String s = br.readLine();
    System.out.println("stringa senza spazi bianchi");
    System.out.println(underscore(s));
  }
}

