Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TextProcessing;
- import java.util.Scanner;
- public class RepeatStrings_02 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine(); //"hi abc add"
- String[] words = input.split(" "); //["hi", "abc", "add"]
- for (String word : words) {
- int n = word.length();
- System.out.print(word.repeat(n));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment