-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringCompare.java
More file actions
37 lines (27 loc) · 794 Bytes
/
Copy pathStringCompare.java
File metadata and controls
37 lines (27 loc) · 794 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
package com;
import java.util.Scanner;
/**
* @CreatedBy cx
* @CreatedTime [Date]
* @description
*/
public class StringCompare {
public static void main(String[] args) {
//a("abc","ads");
Scanner scanner = new Scanner(System.in);
String a = scanner.next().toString();
String b = scanner.next().toString();
System.out.println("sss:" + caculate(a, b));
}
public static int caculate(String s,String b){
int a = 0;
for(int i = 0;i<=s.length()-b.length();i++){
for (int j = 0; j<b.length();j++){
if (s.charAt(i+j)!=b.charAt(j)){
a++;
}
}
}
return a;
}
}