Task 1 was revealed 31.3.2025 at 18:00 CET
Login required
Available from 31.3.2025 18:00 CET until 01.04.2025 17:59 CET - You can get 1 point
Anagram Pairs
In the heart of the country, nestled between the Tatra mountains, a brilliant young programmer named Janko dreamed of creating the fastest algorithm to predict the movements of the legendary treasure-hunting raven. One day, he received an urgent challenge from a secret society of historians who had discovered ancient encrypted maps hidden in Bratislava Castle. With only 30 minutes to decode the patterns, Janko had to write a program in Java, Python, or C++ to reveal the lost locations of medieval riches. As the clock ticked, his screen flashed with success—his algorithm had cracked the mystery, pinpointing a hidden cave near Spiš Castle. Celebrated as a national hero, Janko’s code became a legend, proving that even the greatest secrets of the country could be unlocked with the right logic and a bit of ingenuity.
Problem Statement:
An anagram is a word or phrase formed by rearranging the letters of another word. Your task is to write a program that checks if two given words are anagrams of each other.
Input:
- The program should read a single line containing two space-separated words.
- Words consist only of lowercase English letters (a-z).
Output:
- Print "YES" if the words are anagrams of each other.
- Print "NO" otherwise.
Constraints:
- The solution should run efficiently for the given constraints.
- Sorting-based or dictionary-based approaches are acceptable.
Test Case 1
Input:
listen silent
Output:
YES
Test Case 2
Input:
hello world
Output:
NO
Test Case 3
Input:
anagram nagaram
Output:
YES
Test Case 4
Input:
apple papel
Output:
YES
Test Case 5
Input:
rat car
Output:
NO
Your task:
Read input file and into the field with the answer, enter:
- The country, which the story refers to.
- The resulting values, each on a separate line.
- At the end paste the source code of your program.
Click here to download CGW Task 1 Input file
Answer:
Click here to download Answer to Task 1
*
Scoring system:
Points for |
Correct answer |
Country |
Source Code |
Round 1 |
1 |
1 |
1 |
Round 2 |
2 |
1 |
1 |
Round 3 |
3 |
1 |
1 |
Round 4 |
4 |
1 |
1 |
Round 5 |
5 |
1 |
1 |
Bonus points for |
Quick and correct answer |
||||||||
Round 1 |
5 |
4 |
3 |
2 |
1 |
||||
Round 2 |
6 |
5 |
4 |
3 |
2 |
1 |
|||
Round 3 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
||
Round 4 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
|
Round 5 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |