Write Al algaritham for the network administrator to help him find the number of data character that do not change position even after the data change
public class Main {
public static void main(String[] args) {
String one = "fgsdkgjs'lfj423581-";
String two = "fgdklsj[05923-5fsd";
int notChanged = 0;
for (int i = 0; i < Math.min(one.length(), two.length()); i++) {
if (one.charAt(i) == two.charAt(i)) {
notChanged++;
}
}
System.out.println(notChanged);
}
}
Comments
Leave a comment