String Construction

  • + 0 comments

    include

    using namespace std; int test(string s) { map mp; int sum = 0; for(int i = 0; i < s.length(); i++) { mp[s[i]]++; } for(auto it : mp) { if(it.second = 1) { sum += 1; } else if(it.second >= 2) { sum += 2; } } return sum; } int main() { int t; cin >> t; while(t--) { string s; cin >> s; cout << test(s) << endl; } return 0; }