title: Count Words Appear Exactly Two Times Array Words
signature: fun countWordsAppearExactlyTwoTimesArrayWords(stri: ArrayList<String>, n: Int): Int {
source_py: def count_words_appear_exactly_two_times_array_words(stri, n):
      m = dict()
      for i in range(n):
          m[stri[i]] = (m.get(stri[i], 0) + 1)
      res = 0
      for i in m.values():
          if (i == 2):
              res += 1
      return res
source_cpp: int count_words_appear_exactly_two_times_array_words(vector<string> str, int n) {
    unordered_map < string, int > m;
    for ( int i = 0;
    i < n;
    i ++ ) m [ str [ i ] ] += 1;
    int res = 0;
    for ( auto it = m . begin ( );
    it != m . end ( );
    it ++ ) if ( ( it -> second == 2 ) ) res ++;
    return res;
  }
question_info.test_list: [{"idx": 0, "outputs": 1, "inputs": {"stri": ["hate", "love", "peace", "love", "peace", "hate", "love", "peace", "love", "peace"], "n": 10}}, {"idx": 1, "outputs": 3, "inputs": {"stri": ["16", "946613197072", "532052", "42780833", "511552", "1241934", "4", "3444540", "47487223670074", "23753", "14158", "4", "95420017116714", "16", "0845", "689000748", "976403809728", "8922", "487784120896", "329", "611", "59101", "611", "2131059721", "53952148295020", "445948587", "3905249775372", "4683180907", "7169093", "01413852276627", "63", "5864", "40862536595", "2280304422294", "930028582", "05", "33447"], "n": 32}}, {"idx": 2, "outputs": 1, "inputs": {"stri": ["001000100000", "1010", "01011", "11", "011", "1010"], "n": 6}}, {"idx": 3, "outputs": 2, "inputs": {"stri": ["Om", "Om", "Shankar", "Tripathi", "Tom", "Jerry", "Jerry"], "n": 7}}, {"idx": 4, "outputs": 1, "inputs": {"stri": ["2", "644", "2", "42484637089", "81578664", "0778"], "n": 6}}, {"idx": 5, "outputs": 2, "inputs": {"stri": ["001000101", "011010", "1", "101010011", "011010", "01", "10111000101", "0", "1", "00101101", "0", "0"], "n": 12}}, {"idx": 6, "outputs": 1, "inputs": {"stri": ["kl", "p sH", "PwCPMPu", "tQoIgPpk", "wtsNP WjS", "kl ", "TXsFWgU", "kl", "AD", "NjjTyFGwNWZcB", "jpFQslbGbDI", "cEpGAgvpk", "EMaDkMOm", "YZuNZgfwDIjG", "k", "hJx jHmGpQYwQP", "CIETe", "RH", "Pj", "h", "DInR", "AEsqOvliQtz", "NwzHTALTt LS", "LwLR", "WvDCzlQF", "soJb", "WktoldCbWyTO", "pIdRJxY", "BmpWxjOwTXkjjL", "zmtCiQ", "g", "yBmDW", "QhaBZrQnOJaAJ", "u", "MGTwCKve", "UxYQrONag", "xsGSz", "dqNPTT", "U W", "ygJKvCEKDClby", "M", "yXJQHxjyDQDLkT", "oJmaREOEk YA", "zUwiwhSMdiC", "jYgZEktcdgLD", "fwyTAAW", "GENttdzeGY "], "n": 43}}, {"idx": 7, "outputs": 0, "inputs": {"stri": ["938", "074209", "0949093096", "218622476", "71692175", "0714", "81217924991", "74016430795374", "52213147", "338", "939", "798161500954", "90528060774015", "68715", "75810", "43450", "8017", "0193164", "5945740", "212", "4589289", "2912211026", "0", "49", "8230114", "0733435391403", "5429", "10070"], "n": 20}}, {"idx": 8, "outputs": 1, "inputs": {"stri": ["00", "0", "00", "0101111010100", "110"], "n": 4}}, {"idx": 9, "outputs": 2, "inputs": {"stri": ["g", "h", "ok", "h", "ok", "sqozuC", "ut", "ZwRcG", "ok", "MR", "jHrWyy", "qaJlrokgRHuZH", "LjPNzDUKszYmCq", "g", "ZGjLfMnyAGL", "kEZoSxOMEWSFpw", "IFtqNaDVnG", "iJoJXl", "vjrQMyWor", "FTEHZqbHGlmHph", "QeSdzm", "nPostKHkigyJt", "mOSekk"], "n": 15}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(stri: ArrayList<String>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(stri, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf("hate", "love", "peace", "love", "peace", "hate", "love", "peace", "love", "peace"), 10, 1)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf("16", "946613197072", "532052", "42780833", "511552", "1241934", "4", "3444540", "47487223670074", "23753", "14158", "4", "95420017116714", "16", "0845", "689000748", "976403809728", "8922", "487784120896", "329", "611", "59101", "611", "2131059721", "53952148295020", "445948587", "3905249775372", "4683180907", "7169093", "01413852276627", "63", "5864", "40862536595", "2280304422294", "930028582", "05", "33447"), 32, 3)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf("001000100000", "1010", "01011", "11", "011", "1010"), 6, 1)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf("Om", "Om", "Shankar", "Tripathi", "Tom", "Jerry", "Jerry"), 7, 2)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf("2", "644", "2", "42484637089", "81578664", "0778"), 6, 1)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf("001000101", "011010", "1", "101010011", "011010", "01", "10111000101", "0", "1", "00101101", "0", "0"), 12, 2)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf("kl", "p sH", "PwCPMPu", "tQoIgPpk", "wtsNP WjS", "kl ", "TXsFWgU", "kl", "AD", "NjjTyFGwNWZcB", "jpFQslbGbDI", "cEpGAgvpk", "EMaDkMOm", "YZuNZgfwDIjG", "k", "hJx jHmGpQYwQP", "CIETe", "RH", "Pj", "h", "DInR", "AEsqOvliQtz", "NwzHTALTt LS", "LwLR", "WvDCzlQF", "soJb", "WktoldCbWyTO", "pIdRJxY", "BmpWxjOwTXkjjL", "zmtCiQ", "g", "yBmDW", "QhaBZrQnOJaAJ", "u", "MGTwCKve", "UxYQrONag", "xsGSz", "dqNPTT", "U W", "ygJKvCEKDClby", "M", "yXJQHxjyDQDLkT", "oJmaREOEk YA", "zUwiwhSMdiC", "jYgZEktcdgLD", "fwyTAAW", "GENttdzeGY "), 43, 1)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf("938", "074209", "0949093096", "218622476", "71692175", "0714", "81217924991", "74016430795374", "52213147", "338", "939", "798161500954", "90528060774015", "68715", "75810", "43450", "8017", "0193164", "5945740", "212", "4589289", "2912211026", "0", "49", "8230114", "0733435391403", "5429", "10070"), 20, 0)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf("00", "0", "00", "0101111010100", "110"), 4, 1)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf("g", "h", "ok", "h", "ok", "sqozuC", "ut", "ZwRcG", "ok", "MR", "jHrWyy", "qaJlrokgRHuZH", "LjPNzDUKszYmCq", "g", "ZGjLfMnyAGL", "kEZoSxOMEWSFpw", "IFtqNaDVnG", "iJoJXl", "vjrQMyWor", "FTEHZqbHGlmHph", "QeSdzm", "nPostKHkigyJt", "mOSekk"), 15, 2)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: countWordsAppearExactlyTwoTimesArrayWords
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn