forked from NaNaDi/Programming_Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExpand.java
More file actions
20 lines (14 loc) · 750 Bytes
/
Copy pathExpand.java
File metadata and controls
20 lines (14 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Scanner;
//advanced
public class Expand {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//todo: take as an input a combination of characters and numbers (e.g. 2a3b5c)
//expand the String by printing each letter so many times as the number before the letter indicates
//e.g. 2a3b5c -> aabbbccccc
//Hint: first start with inputs where there is always a number and then a character, then think about how
//to improve your code such that you can use values greater or equal 10, eg. 10a13b22c
//Further modification: if a character should only be printed one time you don't need to write any number infront of that character
//e.g. a3b12cd5e -> abbbccccccccccccdeeeee
}
}