Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Section7
  3. {
  4. public static void main(String[] args)
  5. {
  6. int start = 0, end = 1, count = 0, index;
  7. String word, smallWord = "k";
  8. Scanner input = new Scanner(System.in);
  9. System.out.println("Please enter a line to edit");
  10. word = input.nextLine();
  11.  
  12. while (word.contains("a") || word.contains("e") || word.contains("i") || word.contains("o") || word.contains("u"))
  13. {
  14. while (!smallWord.contains("a") && !smallWord.contains("e") && !smallWord.contains("i") && !smallWord.contains("o") && !smallWord.contains("u"))
  15. {
  16. smallWord = word.substring(start,end);
  17. start++;
  18. end++;
  19. }
  20. count++;
  21.  
  22. index = word.indexOf(smallWord);
  23.  
  24. word = (word.substring(0,index) + count + word.substring(index+1));
  25.  
  26. smallWord = "k";
  27. }
  28.  
  29. System.out.println("Here is your modified input: " + word);
  30. System.out.println("I just replaced " + count + " lower case vowels");
  31.  
  32. input.close();
  33.  
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement