12345678910111213141516171819202122232425262728293031323334 |
- package main
- import (
- "bufio"
- "fmt"
- "os"
- )
- func main() {
- var input = bufio.NewScanner(os.Stdin)
- var output byte
- for input.Scan() {
- line := input.Text()
- output = firstUniqChar(line)
- fmt.Println(string(output))
- }
- }
- func firstUniqChar(s string) byte {
- var record = [26]int{}
- for i := 0; i < len(s); i++ {
- var key = s[i] - 'a'
- record[key]++
- }
- for i := 0; i < len(s); i++ {
- var key = s[i] - 'a'
- if record[key] == 1 {
- return s[i]
- }
- }
- return ' '
- }
|