1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
|
public static void main(String[] args) {
//String erstellen und einlesen
Scanner scanner = new Scanner(System.in);
System.out.println("Gib ein Wort ein");
char[] s = scanner.next().toCharArray();
//Beschriftung
System.out.println(s);
//Ausfüllen der Matrix
for (int i = 0; i < s.length; i++) {
for (int j = 0; j < s.length; j++) {
//Auf Treffer prüfen
if (s[i] == s[j]) {
System.out.print("x");
} else {
System.out.print("0");
}
}
System.out.println();
}
} |