Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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()));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement