/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Map;
import java.util.TreeMap;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String s
= "VĂȘ se tira notas boas!"; Map
<String, Integer
> map
= contar
(s.
replace(" ",
"").
toLowerCase()); Imprimir(map);
}
{
Map
<String, Integer
> map
= new TreeMap
<>(); for(char item : frase.toCharArray())
{
if (s != null)
{
map.
put(String.
valueOf(item
),
++s
); }
else
{
map.
put(String.
valueOf(item
),
1); }
}
return map;
}
public static void Imprimir
(Map
<String, Integer
> items
) {
for(Map.
Entry<String, Integer
> a
: items.
entrySet()) {
System.
out.
println(a.
getKey() + ": " + a.
getValue()); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuSGFzaE1hcDsKaW1wb3J0IGphdmEudXRpbC5NYXA7CmltcG9ydCBqYXZhLnV0aWwuTWFwOwppbXBvcnQgamF2YS51dGlsLlRyZWVNYXA7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZyBzID0gIlbDqiBzZSB0aXJhIG5vdGFzIGJvYXMhIjsKICAgICAgICBNYXA8U3RyaW5nLCBJbnRlZ2VyPiBtYXAgPSBjb250YXIocy5yZXBsYWNlKCIgIiwgIiIpLnRvTG93ZXJDYXNlKCkpOwogICAgICAgIEltcHJpbWlyKG1hcCk7Cgl9CglwdWJsaWMgc3RhdGljIE1hcDxTdHJpbmcsIEludGVnZXI+IGNvbnRhcihTdHJpbmcgZnJhc2UpCiAgICB7ICAgICAgICAKICAgICAgICBNYXA8U3RyaW5nLCBJbnRlZ2VyPiBtYXAgPSBuZXcgVHJlZU1hcDw+KCk7ICAgICAgICAgICAgICAgIAogICAgICAgIGZvcihjaGFyIGl0ZW0gOiBmcmFzZS50b0NoYXJBcnJheSgpKQogICAgICAgIHsKICAgICAgICAgICAgSW50ZWdlciBzID0gbWFwLmdldChTdHJpbmcudmFsdWVPZihpdGVtKSk7CiAgICAgICAgICAgIGlmIChzICE9IG51bGwpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIG1hcC5wdXQoU3RyaW5nLnZhbHVlT2YoaXRlbSksICsrcyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBtYXAucHV0KFN0cmluZy52YWx1ZU9mKGl0ZW0pLCAxKTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICByZXR1cm4gbWFwOwogICAgfQogICAgCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgSW1wcmltaXIoTWFwPFN0cmluZywgSW50ZWdlcj4gaXRlbXMpCiAgICB7ICAgICAgIAogICAgICAgIGZvcihNYXAuRW50cnk8U3RyaW5nLCBJbnRlZ2VyPiBhIDogaXRlbXMuZW50cnlTZXQoKSkKICAgICAgICB7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihhLmdldEtleSgpICsgIjogIiArICBhLmdldFZhbHVlKCkpOwogICAgICAgIH0gICAgCiAgICB9IAp9