Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Section7
- {
- public static void main(String[] args)
- {
- int start = 0, end = 1, count = 0, index;
- String word, smallWord = "k";
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter a line to edit");
- word = input.nextLine();
- while (word.contains("a") || word.contains("e") || word.contains("i") || word.contains("o") || word.contains("u"))
- {
- while (!smallWord.contains("a") && !smallWord.contains("e") && !smallWord.contains("i") && !smallWord.contains("o") && !smallWord.contains("u"))
- {
- smallWord = word.substring(start,end);
- start++;
- end++;
- }
- count++;
- index = word.indexOf(smallWord);
- word = (word.substring(0,index) + count + word.substring(index+1));
- smallWord = "k";
- }
- System.out.println("Here is your modified input: " + word);
- System.out.println("I just replaced " + count + " lower case vowels");
- input.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement