Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Assignment11C
- {
- public static void main(String[]args)
- {
- int i,repeat=1;
- String sentence,s,dummy;
- Scanner input=new Scanner(System.in);
- while(repeat==1)
- {
- System.out.println("Enter your sentence");
- sentence=input.nextLine();
- for(i=0;i<sentence.length();i++)
- {
- sentence=sentence.replaceAll("foo","oof");
- }
- System.out.println("Here is the updated sentence");
- System.out.println(sentence);
- System.out.println("Do you want to repeat Y(1) or N(2)");
- repeat=input.nextInt();
- dummy=input.nextLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement