---
# System prepended metadata

title: Slang Dictionary

---

# Slang Dictionary

## Requirements
[![image](https://hackmd.io/_uploads/BJgyALeEC.png)](https://www.geeksforgeeks.org/learn-data-structures-and-algorithms-dsa-tutorial/)
> [Learn Data Structures and Algorithms | DSA Tutorial
](https://www.geeksforgeeks.org/learn-data-structures-and-algorithms-dsa-tutorial/)

1. Use C/C++!
2. Implement Data Structure & Algorithm!
3. Implement the sorting algorithm manually!
4. Ensure that you didn’t use regex in your work, or it will affect your score!
5. You're allowed to make the interface as creative as you want to. But please, focus on the main logic and main feature first!

## Feature

1. Release a new slang word
2. Search a slang word
3. View all slang words starting with a certain prefix word
4. View all slang words
5. Exit

### Option 1: Release a new slang word

- Ask the user to input the new slang word. Validate that the slang word must be more than 1 character and contains no space.
- Ask the user to input the description (meaning) of the new word. Validate that the description must be more than 1 word.
- Store the new released slang word to a Trie data structure along with its description.

```
Input a new slang word [Must be more than 1 characters and contains no space]: d
Input a new slang word [Must be more than 1 characters and contains no space]: d a
Input a new slang word [Must be more than 1 characters and contains no space]: da
Input a new slang word description [Must be more than 2 words]: The
Input a new slang word description [Must be more than 2 words]: The word the

Successfully released new slang word.
Press enter to continue...
```

- If the slang word already exists in the Trie, then update the description with the new description.

```
Input a new slang word [Must be more than 1 characters and contains no space]: da
Input a new slang word description [Must be more than 2 words]: Same meaning as word “the”

Successfully updated a slang word.
Press enter to continue...
```

### Option 2: Search a slang word

- Ask the user to input the slang word that want to be searched. Validate that the slang word must be more than 1 character and contains no space.
- Search the input word in the Trie data structure.
- If there is no such word, please show empty message for the user and go back to main menu.

```
Input a slang word to be searched [Must be more than 1 characters and contains no space]: de

There is no word “de” in the dictionary.
Press enter to continue...
```

- If there is such word, please show the word along with its description.

```
Input a slang word to be searched [Must be more than 1 characters and contains no space]: d
Input a slang word to be searched [Must be more than 1 characters and contains no space]: d a
Input a slang word to be searched [Must be more than 1 characters and contains no space]: da

Slang word  : da
Description : Same meaning as word “the”

Press enter to continue...
```

### Option 3: View all slang words starting with a certain prefix word

- Ask the user to input the prefix word that want to be searched.
- Search the input word in the Trie data structure.
- If there is no such word, please show empty message for the user.

```
Input a prefix to be searched: de

There is no prefix “de” in the dictionary.
Press enter to continue...
```

- If there is such word, please show the list of words in the dictionary that starts with the prefix word in lexicographical order.

```
Input a prefix to be searched: da

Words starts with “da”:
1. da
2. dadan
3. daijobu
4. dawg
5. dazz

Press enter to continue...
```

- Make it responsive so that everytime the user type, it will update just like Google search recommendation

![image](https://hackmd.io/_uploads/BJpFuqg4C.png)

### Option 4: View all slang words

- If there is no word yet in the dictionary, please show empty message for the user.

```
There is no slang word yet in the dictionary.
Press enter to continue...
```

- Else, please show the list of all words in the dictionary in lexicographical order.

```
List of all slang words in the dictionary:
1. da
2. dadan
3. daijobu
4. dawg
5. dazz
6. rizz
7. simp

Press enter to continue...
```

### Option 5: Exit

- Close the program

```
Thank you... Have a nice day :)
```

## Bonus Points

- Adding extra feature and able to explain it
- Able to save & load the dictionary data so that you dont have to start with an empty dictionary everytime you start the program.

## Good Luck, Have fun!!!

> If you can dream it. You can do it!