Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits\stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- scanf("%d", &t);
- while(t--)
- {
- int n, i;
- scanf("%d", &n);
- string s;
- cin >> s;
- int cnt = 0, j = 0;
- bool flag = false;
- char s1[2];
- for(i = 0; i < s.length(); i++)
- {
- if(s[i] != '0' && (s[i] - '0') % 2 == 1)
- {
- cnt++;
- s1[j++] = s[i];
- if(cnt == 2)
- {
- flag = true;
- break;
- }
- }
- }
- if(!flag) printf("-1\n");
- else
- {
- for(i = 0; i < 2; i++) printf("%c", s1[i]);
- printf("\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement