/* 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); while (true) {
System.
out.
println("Digite a frase (ou * para encerrar): "); if ("*".equals(frase))
break;
String[] vetor
= frase.
split(" "); if (vetor.length > 1) {
char anterior = vetor[0].charAt(0);
boolean todosIguais = true;
for (int i = 1; i < vetor.length; i++) {
char atual = vetor[i].charAt(0);
todosIguais = false;
break;
}
anterior = atual;
}
System.
out.
println("Todas as palavras" + (todosIguais
? " " : " não ") + "começam com a mesma letra"); } else System.
out.
println("Só tem uma palavra, não há o que verificar"); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewogICAgICAgIFNjYW5uZXIgc2MgPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwogICAgICAgIHdoaWxlICh0cnVlKSB7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiRGlnaXRlIGEgZnJhc2UgKG91ICogcGFyYSBlbmNlcnJhcik6ICIpOwogICAgICAgICAgICBTdHJpbmcgZnJhc2UgPSBzYy5uZXh0TGluZSgpOwogICAgICAgICAgICBpZiAoIioiLmVxdWFscyhmcmFzZSkpCiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgU3RyaW5nW10gdmV0b3IgPSBmcmFzZS5zcGxpdCgiICIpOwogICAgICAgICAgICBpZiAodmV0b3IubGVuZ3RoID4gMSkgewogICAgICAgICAgICAgICAgY2hhciBhbnRlcmlvciA9IHZldG9yWzBdLmNoYXJBdCgwKTsKICAgICAgICAgICAgICAgIGJvb2xlYW4gdG9kb3NJZ3VhaXMgPSB0cnVlOwogICAgICAgICAgICAgICAgZm9yIChpbnQgaSA9IDE7IGkgPCB2ZXRvci5sZW5ndGg7IGkrKykgewogICAgICAgICAgICAgICAgICAgIGNoYXIgYXR1YWwgPSB2ZXRvcltpXS5jaGFyQXQoMCk7CiAgICAgICAgICAgICAgICAgICAgaWYgKENoYXJhY3Rlci50b0xvd2VyQ2FzZShhdHVhbCkgIT0gQ2hhcmFjdGVyLnRvTG93ZXJDYXNlKGFudGVyaW9yKSkgewogICAgICAgICAgICAgICAgICAgICAgICB0b2Rvc0lndWFpcyA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgYW50ZXJpb3IgPSBhdHVhbDsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiVG9kYXMgYXMgcGFsYXZyYXMiICsgKHRvZG9zSWd1YWlzID8gIiAiIDogIiBuw6NvICIpICsgImNvbWXDp2FtIGNvbSBhIG1lc21hIGxldHJhIik7CiAgICAgICAgICAgIH0gZWxzZSBTeXN0ZW0ub3V0LnByaW50bG4oIlPDsyB0ZW0gdW1hIHBhbGF2cmEsIG7Do28gaMOhIG8gcXVlIHZlcmlmaWNhciIpOwogICAgICAgIH0KCX0KfQ==