Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <set>
- #include <vector>
- #include <algorithm>
- #define pb push_back
- using namespace std;
- void f()
- {
- set <char> all;
- vector <char> v;
- for (int i = 0; i < 4; ++i) {
- char k; cin >> k;
- all.insert(k);
- v.pb(k);
- }
- if (all.size() == 1) {
- cout << -1;
- exit(0);
- }
- if (all.size() == 2) {
- int x = count(v.begin(), v.end(), v[0]);
- if (x == 1 || x == 3) {
- cout << 6;
- exit(0);
- }
- }
- cout << 4;
- }
- int main()
- {
- int t; cin >> t;
- for (int i = 0; i < t; ++i) {
- f();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement