/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Scanner sc
= new Scanner
(System.
in);
System.
out.
println ("Escreva os Nomes na Primeira Lista: ");
for(int i = 0; i < lista1.length; i++){
lista1[i] = sc.nextLine();
}
System.
out.
println ("Escreva os Nomes na Segunda Lista: ");
for(int i = 0; i < lista2.length; i++){
lista2[i] = sc.nextLine();
}
System.
out.
println (calcularLista
(lista1, lista2
));
}
public static double calcularLista
(String lista1
[],
String lista2
[]) {
int cont = 0;
double tamanhoLista2 = lista2.length;
for (int i = 0; i<lista1.length;i++) {
for(int z = 0; z<tamanhoLista2;z++){
if (lista1[i].equals(lista2[z])) {
cont++;
break;
}
}
}
return (cont * 100)/tamanhoLista2;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCSAgICAgICAgCgkJU2Nhbm5lciBzYyA9IG5ldyBTY2FubmVyIChTeXN0ZW0uaW4pOwoKICAgICAgICBTdHJpbmcgW10gbGlzdGExID0gbmV3IFN0cmluZyBbNF07CiAgICAgICAgU3RyaW5nIFtdIGxpc3RhMiA9IG5ldyBTdHJpbmcgWzRdOwoJCQoJCVN5c3RlbS5vdXQucHJpbnRsbiAoIkVzY3JldmEgb3MgTm9tZXMgbmEgUHJpbWVpcmEgTGlzdGE6ICIpOwogICAgICAgIAogICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBsaXN0YTEubGVuZ3RoOyBpKyspewogICAgICAgIAlsaXN0YTFbaV0gPSBzYy5uZXh0TGluZSgpOwogICAgICAgIH0KCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuICgiRXNjcmV2YSBvcyBOb21lcyBuYSBTZWd1bmRhIExpc3RhOiAiKTsKICAgICAgICAKICAgICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBsaXN0YTIubGVuZ3RoOyBpKyspewogICAgICAgIAlsaXN0YTJbaV0gPSBzYy5uZXh0TGluZSgpOwogICAgICAgIH0KCiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuIChjYWxjdWxhckxpc3RhIChsaXN0YTEsIGxpc3RhMikpOwogICAgICAgIAoJfQoJCgkgIHB1YmxpYyBzdGF0aWMgZG91YmxlIGNhbGN1bGFyTGlzdGEoU3RyaW5nIGxpc3RhMVtdLCBTdHJpbmcgbGlzdGEyW10pIHsKCiAgICAgICAgICAgIGludCBjb250ID0gMDsKICAgICAgICAgICAgZG91YmxlIHRhbWFuaG9MaXN0YTIgPSBsaXN0YTIubGVuZ3RoOwoKICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGk8bGlzdGExLmxlbmd0aDtpKyspIHsKICAgICAgICAgICAgCQogICAgICAgICAgICAJZm9yKGludCB6ID0gMDsgejx0YW1hbmhvTGlzdGEyO3orKyl7CgogICAgICAgICAgICAgICAgCWlmIChsaXN0YTFbaV0uZXF1YWxzKGxpc3RhMlt6XSkpIHsKCiAgICAgICAgICAgICAgICAgICAgCWNvbnQrKzsKICAgICAgICAgICAgICAgICAgICAJYnJlYWs7CiAgICAgICAgICAgICAgICAJfQogICAgICAgICAgICAJfQogICAgICAgICAgICB9CgogICAgICAgICAgICByZXR1cm4gKGNvbnQgKiAxMDApL3RhbWFuaG9MaXN0YTI7CiAgICAgICAgfQp9