-
Notifications
You must be signed in to change notification settings - Fork 1
/
p2.java
33 lines (29 loc) · 923 Bytes
/
p2.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
public class p2{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String string1,string2;
System.out.println("Enter the first String : ");
string1 = sc.nextLine();
System.out.println("Enter the second String : ");
string2 = sc.nextLine();
char [] c1 = string1.toCharArray();
char [] c2 = string2.toCharArray();
for(int j=0;j<c2.length;j++) {
for(int i=0;i<c1.length;i++) {
if(c1[i] == c2[j]) {
c1[i] = 0;
}
}
}
System.out.println("After removing the characters of second string from first string :");
for(int i=0;i<c1.length;i++) {
System.out.print(c1[i]);
}
}
}
//..............
//$
//.......
// updated.....
////////////// still getting updated