# Isogram

## Introduction

Determine if a word or phrase is an isogram.

An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.

Examples of isograms:

* lumberjacks
* background
* downstream
* six-year-old

The word *isograms*, however, is not an isogram, because the s repeats.

### Running the tests

To run the tests run the command `go test` from within the exercise directory.

If the test suite contains benchmarks, you can run these with the `--bench`and `--benchmem` flags:

```
go test -v --bench . --benchmem
```

Keep in mind that each reviewer will run benchmarks on a different machine, with different specs, so the results from these benchmark tests may vary.

### Further information

For more detailed information about the Go track, including how to get help if you're having trouble, please visit the exercism.io [Go language page](http://exercism.io/languages/go/resources).

### Source

Wikipedia <https://en.wikipedia.org/wiki/Isogram>

### Submitting Incomplete Solutions

It's possible to submit an incomplete solution so you can see how others have completed the exercise.

{% tabs %}
{% tab title="First Tab" %}

```go
package isogram

import "strings"

func noSpaceorHyphens(s string) string {
	rep := strings.NewReplacer(" ", "", "-", "")
	return rep.Replace(s)
}

// IsIsogram is a function to check string duplicate
func IsIsogram(input string) bool {
	input = noSpaceorHyphens(input)
	input = strings.ToLower(input)
	temp := map[string]struct{}{}
	for _, r := range input {
		if _, ok := temp[string(r)]; !ok {
			temp[string(r)] = struct{}{}
		} else {
			return false
		}
	}
	return true
}
```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}

## Point

* Use the feature of Map&#x20;

```go
i, ok := m["route"]
```

In this statement, the first value (`i`) is assigned the value stored under the key `"route"`. If that key doesn't exist, `i` is the value type's zero value (`0`). The second value (`ok`) is a `bool` that is `true` if the key exists in the map, and `false` if not.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dingyj.gitbook.io/blog/golang/exercism/isogram.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
