-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathu6.java
More file actions
29 lines (28 loc) · 810 Bytes
/
Copy pathu6.java
File metadata and controls
29 lines (28 loc) · 810 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
import java.util.Scanner;
public class u6 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
String str1=s.nextLine();
String str2=s.nextLine();
int count=0;
if(str1.length()!=str2.length()){
System.out.println("not equal");
}
else{
for(int i=0;i<str1.length();i++){
if(str1.charAt(i)!=str2.charAt(i)){
count++;
}
}
if(count==0) {
System.out.println("equal string");
}
else if(count>2){
System.out.println("not 1 char difference");
}
else{
System.out.println("1 char difference");
}
}
}
}