Problem:
Score : 100 points

Problem Statement

You are given a 4-character string S consisting of uppercase English letters.
Determine if S consists of exactly two kinds of characters which both appear twice in S.

Constraints

The length of S is 4.

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

S

Output

If S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.

Sample Input 1

ASSA

Sample Output 1

Yes

S consists of A and S which both appear twice in S.

Sample Input 2

STOP

Sample Output 2

No

Sample Input 3

FFEE

Sample Output 3

Yes

Sample Input 4

FREE

Sample Output 4

No

Solution in Go (1.6) (judge verdict: Wrong Answer)

package main
import (
   "fmt"
   "os"
   "bufio"
   "strings"
   "strconv"
)

func StrStdin() (stringInput string) {
  scanner := bufio.NewScanner(os.Stdin)
  scanner.Scan()
  stringInput = scanner.Text()
  // stringInput = strings.TrimSpace(stringInput)
  return
}

func IntStdin() (int, error) {
  stringInput := StrStdin()
  return strconv.Atoi(strings.TrimSpace(stringInput))
}

func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
  stringSplited := strings.Split(stringTargeted, delim)

  for _, str := range stringSplited {
    if str != "" {
      stringReturned = append(stringReturned, str)
    }
  }
  return
}

func SplitStrStdin(delim string) (stringReturned []string){
  // 文字列で1行取得
  stringInput := StrStdin()

  // 空白で分割
  // stringSplited := strings.Split(stringInput, delim)
  stringReturned = SplitWithoutEmpty(stringInput, delim)

  return
}

func judge_same_string(wordlist []string) (flag bool){
    var count int
    // オーダー悪い
    for jdx := 0; jdx < 4-1; jdx += 1 {
      for kdx := jdx+1; kdx < 4; kdx += 1 {
        if wordlist[jdx] == wordlist[kdx] {
            //fmt.Println(jdx)
            //fmt.Println(kdx)
            count += 1 
        }
      }
    }
    //fmt.Println(count)
    if count == 2 {
      fmt.Println(true)
    } else {
      fmt.Println(false)
    }
    return
}

func main() {
    //var words []string

    //len, _ := IntStdin()
    //for idx := 0; idx < len; idx += 1 {
        wordlist := SplitStrStdin("")
        //words = append(words, strings.Join(wordlist, ""))
        judge_same_string(wordlist)
    //}
}