-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString6.java
More file actions
44 lines (27 loc) · 835 Bytes
/
String6.java
File metadata and controls
44 lines (27 loc) · 835 Bytes
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
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.*;
public class String6 {
public static void main(String args[]) {
int count = 0;
Scanner str = new Scanner(System.in);
System.out.print("Enter the String 1 :- ");
String str1=str.nextLine();
System.out.print("Enter the String 2 :- ");
String str2=str.nextLine();
System.out.println("String 1 :- "+str1);
System.out.println("String 2 :- "+str2);
if (str1.length()==str2.length())
{
for (int i =0 ;i<str1.length();i++) {
if (str1.contains("--") && str2.contains("--") && str1.indexOf("--")==str2.indexOf("--")&&str1.charAt(i)==str2.charAt(i))
{
count++;
}
}
}
else System.out.print("False");
if (count>2&&count%2==0)
{
System.out.print("True");
}else System.out.print("False");
}
}