{"id":1306,"date":"2016-08-29T17:04:31","date_gmt":"2016-08-29T14:04:31","guid":{"rendered":"http:\/\/java.mazurok.com\/?p=1306"},"modified":"2016-11-19T22:09:19","modified_gmt":"2016-11-19T19:09:19","slug":"e-olymp-2166-anagrams","status":"publish","type":"post","link":"https:\/\/java.mazurok.com\/?p=1306","title":{"rendered":"e-olymp 2166: \u0410\u043d\u0430\u0433\u0440\u0430\u043c\u043c\u044b"},"content":{"rendered":"<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430<\/strong><\/p>\n<p>\u0421\u043b\u043e\u0432\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0435\u0433\u043e \u0431\u0443\u043a\u0432.<\/p>\n<h4>\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<p>\u0414\u0432\u0430 \u0441\u043b\u043e\u0432\u0430 \u0437\u0430\u0434\u0430\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445. \u0421\u043b\u043e\u0432\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u0445 \u0431\u0443\u043a\u0432 \u0438 \u0446\u0438\u0444\u0440. \u0414\u043b\u0438\u043d\u044b \u0441\u043b\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0442 <strong>255<\/strong>.<\/p>\n<h4>\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u00ab<strong>YES<\/strong>\u00ab, \u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u0438 \u00ab<strong>NO<\/strong>\u00bb \u0435\u0441\u043b\u0438 \u043d\u0435\u0442.<\/p>\n<h4>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/h4>\n<p>\u0412 \u0437\u0430\u0434\u0430\u0447\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043b\u0438 \u0434\u0432\u0430 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\u0430 \u0430\u043d\u0430\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438.<br \/>\n\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u0443\u043a\u0432\u044b \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0441\u043b\u043e\u0432\u0430\u0445 \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u044f\u0445 \u0438 \u044d\u0442\u043e \u043c\u0435\u0448\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0435\u00a0\u043f\u043e \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430\u00a0Arrays.sort, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 sortString, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c \u043d\u043e\u0432\u0443\u044e \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<br \/>\n\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 equals(), \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0435\u0440\u043d\u0435\u0442 \u043d\u0430\u043c true \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u00abYES\u00bb, \u0430 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u00abNO\u00bb.<\/p>\n<h4>\u041a\u043e\u0434<\/h4>\n<pre class=\"lang:java decode:true\">import java.util.*;\r\nimport java.lang.*;\r\nimport java.io.*;\r\n\r\nclass Main\r\n{\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner in = new Scanner(System.in);\r\n\t\tString word1, word2;\r\n\t\tword1 = in.nextLine();\r\n\t\tword2 = in.nextLine();\r\n\t\tif (sort(word1).equals(sort(word2))) {\r\n\t\t\tSystem.out.print(\"YES\");\r\n\t\t}\r\n\t\telse System.out.print(\"NO\");\r\n\t}\r\n\tstatic String sort(String word1) {\r\n\t\tchar[] content = word1.toCharArray();\r\n\t\tArrays.sort(content);\r\n\t\treturn new String(content);\r\n\t}\r\n}<\/pre>\n<p>\u041d\u0430 <a href=\"https:\/\/ideone.com\/1wcLH5\">Ideone<\/a>.<\/p>\n<h4>\u0422\u0435\u0441\u0442<\/h4>\n<table style=\"height: 259px\" width=\"444\">\n<tbody>\n<tr>\n<td style=\"width: 214px\">\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<td style=\"width: 214px\">\u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 214px\">sharm<\/p>\n<p>marsh<\/td>\n<td style=\"width: 214px\">YES<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 214px\">ananas<\/p>\n<p>nnaass<\/td>\n<td style=\"width: 214px\">NO<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 214px\">tommarvoloriddle<br \/>\niamlordvoldemort<\/td>\n<td style=\"width: 214px\">YES<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 e-<a href=\"https:\/\/www.e-olymp.com\/ru\/problems\/2166\">olimp <\/a>\u0438 \u043d\u0430 \u0435\u0435 <a href=\"https:\/\/www.e-olymp.com\/ru\/submissions\/2759074\">\u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0434\u0430\u0447\u0430 \u0421\u043b\u043e\u0432\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0430\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0435\u0433\u043e \u0431\u0443\u043a\u0432. \u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0414\u0432\u0430 \u0441\u043b\u043e\u0432\u0430 \u0437\u0430\u0434\u0430\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445. \u0421\u043b\u043e\u0432\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u0442 \u0438\u0437 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0445 \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u0445 \u0431\u0443\u043a\u0432 \u0438 \u0446\u0438\u0444\u0440. \u0414\u043b\u0438\u043d\u044b \u0441\u043b\u043e\u0432 \u043d\u0435 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0442 255. \u0412\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u00abYES\u00ab, \u0435\u0441\u043b\u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0430\u043d\u0430\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u0438 \u00abNO\u00bb \u0435\u0441\u043b\u0438 \u043d\u0435\u0442. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0412 \u0437\u0430\u0434\u0430\u0447\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f &hellip; <a href=\"https:\/\/java.mazurok.com\/?p=1306\" class=\"more-link\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":80,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[185,111,34,151],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/1306"}],"collection":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/users\/80"}],"replies":[{"embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1306"}],"version-history":[{"count":6,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/1306\/revisions"}],"predecessor-version":[{"id":1630,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=\/wp\/v2\/posts\/1306\/revisions\/1630"}],"wp:attachment":[{"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java.mazurok.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}