MnMWizard icon

Remove hi assignment

MnMWizard | PRO | 12/23/17 06:23:48 PM UTC | 0 ⭐ | 390 👁️ | Never ⏰ | []
text |

630 B

|

None

|

0 👍

/

0 👎

//Mason Marnell - remove hi
 import static java.lang.System.in;
import java.util.Scanner;
 class removeHi {
     public static String removehi(String info)
    {   
        if( ! info.contains("hi")) return info;  // what happens when info does not contain hi, this is your base caes
         return removehi(info.replace("hi", "")) ;   // remove all "hi" from info and try again
    }
     public static void main(String[] args) {
        Scanner keyb = new Scanner(in);
        System.out.println("Enter a word and I'll remove all \"hi\"s");
        System.out.println(removehi(keyb.nextLine()));
    }
 }

Comments