Anche se oggi è il #BlackFriday, per noi di Formati e Occupati il venerdì rimarrà sempre #DebugFriday!

“Sei tranquillo sul divano e la tua ragazza ti dice che vuole partire per andare in vacanza, tuttavia sai bene che le parole delle donne vanno interpretate, così decidi di trovare quelle lettere che compaiono solo una volta in quel fiume di parole che ti ha detto…
Ecco il codice che può risolvere tutti i tuoi problemi…peccato che sia sbagliato…l’ordine delle lettere viene preso casualmente, mentre a te serve sapere l’ordine in cui sono state pronunciate!”

CODICE

package dao;

import java.util.HashMap;

public class P3 {
public static void main(String[] args) {
String testo =  
“%%$@_$^__#)^)&!_+]!*@&^}@ [@%]()%+$&[(_@%+%$*^@$^!+]!&_#)_*}{}}!}_]$[%}@[{_@#_^{*\r\n” +
“@##&{#&{&)*%(]{{([*}@ [@&]+!!*{)!}{%+{))])[!^})+)$]#{*+^((@^@}$[**$&^{$!@#$%)!@(&\r\n” +
“+^!{%_$&@^!}$_${)$_#)!({@!)(^}!*^&!$%_&&}&_#&@{)]{+)%*{&*%*&@%$+]!*__(#!*){%&@++\r\n” +
“!_)^$&&%#+)}!@!)&^}**#!_$([$!$}#*^}$+&#[{*{}{((#$]{[$[$$()_#}!@}^@_&%^*!){*^^_$^\r\n” +
“]@}#%[%!^[^_})+@&}{@*!(@$%$^)}[_!}(*}#}#___}!](@_{{(*#%!%%+*)^+#%}$+_]#}%!**#!^_\r\n” +
“)@)$%%^{_%!@(&{!}$_$[)*!^&{}*#{!)@})!*{^&[&$#@)*@#@_@^_#*!@_#})+[^&!@*}^){%%{&#@\r\n” +
“@{%(&{+(#^{@{)%_$[+}]$]^{^#(*}%)@$@}(#{_&]#%#]{_*({(])$%[!}#@@&_)([*]}$}&${^}@(%\r\n” + 
“(%[@%!}%*$}(*@)}){+@(%@*$&]*^*}*]&$[}*]%]+*}^!}*$^^_()#$^]++@__){&&+((#%+(&+){)$\r\n” +
“%&&#($[[+##*%${)_!+{_[})%++)$#))]]]$]@]@($+{&%&%+!!!@]_]+])^*@$(@#${}}#}{%}#+{(@\r\n” +
“#__+{{]${]!{(%${%%^)(_*_@+)$]$#_@$)]](}{}$(}*%+!}#+)$%$}+#@*&^{##}+@(%[*@_}{(^]^\r\n” +
“+_*{@+[$!!@%$+{_&(#^(([&[][[&@#+}_]&&]}^*&$&)#_^$@$((%)}+{}$#+{+^}&[#[#_+${#[#]{\r\n” +
“(@@ [%}[}$%+*#$+[%(**!$+@$@&+$_$#!_&&&&{***+)}][}#^!%#&$*)$!%}*&#}}##(^_%^]{+]&&]\r\n” +
“}^]#^(}@]&$]*_][])$]{_+})^_}]))()^&)(!*![!&}{][(]})[(*^}$&$_@^$)#${%[$_]!^]}}}*+\r\n” +
“*^_(+}^)(%(}{&)[}!$$&&+}&[{%}^+#$]@)^&*%{@}]&!%*%$*&][}&{$&*@{@#]$*_[]%%[#]#*%)@\r\n” +
“$_^#%$!{#]^$}%^@^+{($!^($%)]+&}+$@ [$*)*&)*%!_!!+@&^*{}%#&{}$!(*^*@]@@})[($!)]]})\r\n” +
“})(&+##]##%&##$}@{#_])*%(*(@$)}[+(+_)!{{#^{_@)!&)$}@^^^[$#__+$^!*#%%]_!#$]$&+^}%\r\n” +
“@])])%}]#$((^+{{@++n^])$^*#[$}*]}}{)@+)[_}*@^%#]]#+()+)(]_[!!!)+)$+&@@])!}+*%]$[]\r\n” +
“&&[@+$_&#[$!$${}{%[]#+@)*!#)*!{$#*$%}[(&@$&_@($$]]]_[+(#@}&_}+]@$#_+](}^})!@@}@)\r\n” +
“}^]^]*}]+&(@@!!](*@#(++*)]!(^$})&_^@+]{#_@*%^[$[%&_%@%_![&&]&_@*#_}[{{])^$[_$_&_\r\n” +
“@%%[@#[@_[&+]}[+)!_#_+++%)[@%$(&$[{#@(}$*![#^#{}_)[$^_$${_@&}*![#*#_+%[@{*^$){)#\r\n” +
“#%}]{+((*^]+{})&#$!#(*%({_!^*[{%@_&#){![&]@$#[#(!{*#^*%)]!%(#]%${*_^{+}(@}{_^(](\r\n” +
“_+!_)^&}!#([(+&[@])[_(]@]@&@{#@(%[@+[^@%@+]*_[{]$[_(_@ [!]]^%+@#(@$}]@(^**+]%^)^(\r\n” +
“@}^[]@@ [@[@}^(^!]%*_]&$!!^^#*[#*[*_}+[$#(_#%@](+[^+}%{_*#]+*(]}!$(%@%#^)}]_&]{${\r\n” +
“}$[*{+&+&}[#_#}_(}){^#{[_%*!$+[#)%]@&&_{)#[+*&+#!&)%)%++$_}){%%*@!*&%__(_!]#$*(_\r\n” +
“$^!@@}_())%(&$%]]{{{@+!&%@(^!+*{%[*[!]){(#$@)(^{]%[&*(&!{&}!%*$)*]]$%(__[}_+&)!(\r\n” +
“^_&*]*+#@{@ [_({$*&}][(*!+$+#%&![%^)^#(#}+*+(@)&&!({^^_*($^+)&{)%$@%)&!$$&&^+#[)$\r\n” +
“+!$^]*!%^_$}$+!!&%_&){$%{((&^{{(&_&_]{^}@ [$^+]}]^{@a!^@_%_{^@*)+^*#$#!+*}#)}@(}!]\r\n” +
“_*)}$**@}[^_&*^)*+#()]&{{]*+#${@&}#)$[]_+(^_@^][]_)*^*+_!{&$##]((](}}{[!$#_{&{){\r\n” +
“*_{^}$#!+]{[^&++*#!]*)]%$!{#^&%(%^*}@^+__])_$@_^#[{{})}$*]#%]{}{][@^!@)_[}{())%)\r\n” +
“())&#@*[#}+#^}#%!![#&*}^{^(({+#*[!{!}){(!*@!+@ [_(*^+*]$]+@+*_##)&)^(@$^]@@][#&)(\r\n” +
“%%{})+^$))[{))}&$(^+{&(#%*@&*(^&{}+!}_!^($}!(}_@@++$)(%}{!{_]%}$!){%^%%@^%&#([+[\r\n” +
“_+%){{p}(#_}&{&++!@_)(_+}%_#+]&^)+]_[@]+$!+{@}$^!&)#%#^&+$@ [+&+{^{*[@]#!{_*[)(#[[\r\n” +
“]*!*}}*_(+&%{&#$&+*_]#+#]!&*@}$%)!})@&)*}#(@}!^(]^@}]#&%)![^!$*)&_]^%{{}(!)_&{_{\r\n” +
“+[_*+}]$_[#@_^]*^*#@{&%})*{&**}}}!_!+{&^)__)@_#$#%{+)^!{}^@ [$+^}&(%%)&!+^_^#}^({\r\n” +
“*%]&@{]++}@$$)}#]{)!+@ [^)!#[%@^!!+{(@&+++_{!$}{]_%_#^#%&{!_(#$%%&@[})]+_@!(*[_@[\r\n” +
“*_&+][^][}^@}])!(&^*[_%+(}!!{!!^*@!({%]#[_&()$]!$]@}*][)#()})[*^[^}]#(((_^#%%]@}\r\n” +
“^###%!{(@+]$%*^}(![$@*]_{#*!$*@%*(^+#!)$&]*%$&*@$[)_$!&+_[$)%_*((%+##*]@+#*[$$)^\r\n” +
“@)]}!)$^%+%&_#+]&&_!(}+^*#)$%%^+&%^_]@*%^^_#]%{%[&(*_(%(*{^@ [@&+!@&[+[++$})$!*}+\r\n” +
“(_^%%*}^{+}(+]]_][_(@}^#_{_}*){*)}+*)%#%++}{}__%$$$[%%*})_#*!_!%&*$!]!}{*+{^()$}\r\n” +
“*$%*$]][{@+*]_*&!^]_*!_{_@(}+%#$+@}_]#@$#^%((#$%+++]])#*@)&([^#]_$%$)[#)){({%@_^\r\n” +
“@#}@*!!()[]%$*+*{*$%@**!}&#[*#[[{(@&_){{!}!)++@*{{({_!#^]}+{{#]{$^)&]%}})^@&$%@$\r\n” +
“$!_+!{]*^_+@&@){#*!_#+{[@$^(__}*[^$&{&]!(&+++_@+)&}))$%]${+*!(#@(}&&&!)!_!$&@&{[\r\n” +
“[@!#!]]#%)(_^!{*[{^{]})$)^&(*)%}#]#()^#+}!{_}*+{@&_^)+%@!%%${$&%}(%*_!)%$((+$&^^\r\n” +
“}#[@%+)&^!](]%+_{{]}@]+^]{(!_*&@][]@_%}%(%&)})&o!#)[_]^+$)[(%*%({]$[(#+&+[@ [*([$#\r\n” +
“^*!@{]]#![[{_]#^@])_[[+%]#[%[+_{)^+([^}[]_[}])*^!_+$}^+_)+*@$$^}(&[)_^[+})^]&)))\r\n” +
“}*+}%){@_)]_)&)!@)*#^_%{}(]]$)+^@+}+$_*&)]%^@&)![!@$[@)@}%!)@$((^![{(%([+#&{$+#[\r\n” +
“#&)!+{)__]+%)![*%^&*^)*#[&(_%*)^_%*^{&_[@%%@^%_}&*@($[@$$#](}&$*&$$((!!}{%!^^$}!\r\n” +
“{]][(!_(+}$%*_]*&$!_[@$})#@)]*%#]*{)$@*!^#[]**+]&])$@*@]{$_+]]^_*+*+)%!_!}#}^@*[\r\n” +
“$[##&_^+&)((_$#!]}[_*]_$^_*{[^$#[{@$[()+*@_$((+}*^!]){][_}!)%{}{&#@ [&#$(}#}%%{!_\r\n” +
“@)[($}&+&$}}%[)@ [{^_+%+[)[^[*{{^#]*__$^%^}#]}*{^+{!@#(+*]$)^(*!^^]^)[}@{%(($(+_#\r\n” +
“*){@}]+}&)[(^^(*$&_$@#[#_$)^_()}{[]]{^@*)_!{@)(!))^_+_]{+_}$%(@#+{*+%@!${*&&@${]\r\n” +
“(}&($(^*{^$])*}$(#}%}#)_@^*}#!)$)&$*__+!!+[&}])*_{+$}!@)*^{{({@}{@}+@#${$^*@^^}(\r\n” +
“[)!^){!+@l%(^_)[]@(]+&^_@ [*(_@^*##*&*$!{^{!&#@(%&(@!]^[]({!+(]+^}&&${{]^!+#^*#&%{\r\n” +
“$[}@&(]^&^@*#[&&}^[!%+#(+(%+&){_@_&%&!$}&)[$]%_^]*@^]&_}&^^^(&(${%#^(#[}}{%))&}{\r\n” +
“%&___*&*((!#&(^)}%**$+_[!#{&_{$_))[${$*([&*%^!$%%&}$&_))}{(_]!+{}@+%{^*_[[@@)%}%\r\n” +
“@)%*(}($$)^!#}+}#$]@})+]&@^!*{@_**{_^{@(^(@++&)!#](&#*[)+!!%{]_*$*(]%+&_^%)$$$*$\r\n” +
“&]@}!&{@ [{(+**#)}${[*@$(+%__{{}#!}@(%^+*)$+&){^(_*&}&__]^*)}]^!!%&$#[)$)+_{!$%@)\r\n” +
“_##)#^*%#}{$}$[!!__$)}(%+[^(^$(%_)#!$[$@+]${$({)[^$+&$($]*!+$^{_(_%}(^)(!_))![*^\r\n” +
“^%^&})[@#}#_%$*}&#!_)!)){*}!@&]*(@^_&[)]!*$&_[@&]($}!]!{)[)[{{_{#(+_!_#{]_(_(${}\r\n” + 
“%*+[}#{)@]&@($+&!^[}![}&$}*^[!)#^_#**${+(!+!#)!^%_#%[][(@(!!}&)_*{%@_^!)_!_@!^!(\r\n” +
“{^](#%%&@#))$&#_&[[#&^&^}))([]&^+^@($!}{+^+*{%[}_*+_*^+$)+%^(}&[_%)$+{}{[*]+$]}&\r\n” +
“@}_]_[%&)[@+}{+&^!#@_{!__!^%[(]@!+*%[!+)!{+_]*&+@*[_(*%+}*@+@&$!+_@+*&[#@%###}^^\r\n” + 
“%_@)$[&){&#&$!&}{@&&*[&!!!({)&{)+]^*&)]+[+^%^[_&+^$!$!+!+_(}+^}+&#*_&*(+_+[[)$!}\r\n” + 
“^$]}%](]]#_}[(&${{+((][_*%!)(##[@*&(^!_]**}[}{[%]*!$])[_))&(^$)%))&(+^@$&${_@![!\r\n” + 
“#(}_{$(&_&[_]%*&*@]}]}[{!&*}{{&+*$@%%}$+^[}{&$^%%^]#%{#](_){[()@@)[@]!#!%)&*+]_}\r\n” + 
“}[([#}[}&&}+{@!@+}]){_)%_+({{!]*}}^(!])#*^)(#&!)_#i$[%_#{!##%%+)@{**)%+&*[*#[+*$)\r\n” + 
“@(!%)*)^]![_^%#)}*#!_@_@)(#)(_(]!%@)!_+_)]!*@{&!^%_+*(%%$!!_^}@^^{[@#*&+[(%#[{({\r\n” + 
“+)&+_$!${]+}^$[!]_#{{#]!{[&[$@*^]}@]}+{)_#}@_^%%$^{+($*[###@))]}@!@]]{^[_@)!@{@}\r\n” + 
“*+^(_]*$!_^_+[#))$$]*+%}{[&([&)@#{#)*%)])!_^+%%*#(+!}+{[#+#%%]@((]!_#@*%&(@ [(@@#\r\n” + 
“^#}@}[*@})&$)@#+*!}^^()[^#^])+$$*%^*@^^!^$^#_!@^^(_&&][)@(%([[]&]]{[^}!@^[+${*%#\r\n” + 
“{[!({&_(_!+$]@}@!))$[[+#+{(@&@^{]]*][]}_$$$)##&&^#_{}}#[*%(+&]@%{@)!&{+{*^_#_$*^\r\n” + 
“[]}+^+*{[)}![}@ [#$)}_^}#$!#%{([*_^+!#}$@{{&)!#*$#*@&)@&]^}!+{!}{)%}^[}]}[$&)^$)$\r\n” + 
“+){@)%$*[$_#))[({)&()[_^&^+#}%#((+@@ [$+!^[%*_{]*+)}#$${+!@_)@@)@%**]_]))$$^&**!_\r\n” + 
“{!]^*+#]$!@+!$)^%)!&[$*[@!(_)[![)(}$}*)$(&%%&+^}+^%%&^_}]!(&]#+$*__*))#*{_&*]{*@\r\n” + 
“}_{%]]$)(#@![!(_]!)+&$&^(){$%_(_%+}%*%&%!!^^)(_*@{^#())[{^&@}#{{^_$[*()*$&%^_{)%\r\n” ;

HashMap<String,Integer> hash = new HashMap<String,Integer>();

for(String s:testo.split(“”))
       if(hash.containsKey(s))
             hash.put(s,hash.get(s)+1);
       else
             hash.put(s, 1);

for(String s:hash.keySet())
       if(hash.get(s)==1)
               System.out.println(s);
  }

}

BUON WEEKEND A TUTTI … QUELLI CHE RIUSCIRANNO A RISOLVERLO!

Se ti piace questo articolo, faccelo sapere in un commento e condividilo!

La soluzione sarà pubblicata Lunedì alle 13