How to check, if a word can be made by letters of another word. using every letter only once.

**Example:**

if `str = "computer";` then

```
//if user enters below words output must be true
  comp
  put
  poet

//and if user enters below words output must be false
  count         // since n is not in str 
  root          // since there is only single o in str    

```