Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<string>
- #include<sstream>
- using namespace std;
- int firstNonRepeating(vector<unsigned int> &arr, int & n)
- {
- for (int i = 0; i < n; i++) {
- int j;
- for (j = 0; j < n; j++)
- if (i != j && arr[i] == arr[j])
- break;
- if (j == n)
- return arr[i];
- }
- return -1;
- }
- void Dec2Hex(int no)
- {
- int hex=0;
- if(!no)
- return;
- else {
- hex=no%16;
- Dec2Hex(no/16);
- }
- if(hex>9)
- printf("%c",'a'+(hex-10));
- else
- printf("%d",hex);
- }
- int main(){
- cin.sync_with_stdio(false);
- cout.sync_with_stdio(false);
- string Input;
- // while (Input != ".")
- // {
- // cin >> Input;
- // if (Input == ".")
- // break;
- // }
- getline(cin, Input, '.');
- vector<unsigned int> dna;
- for (unsigned int i = 0; i < Input.length(); i += 5)
- {
- stringstream stream(Input.substr(i, 5));
- unsigned int num;
- while (stream >> hex >> num)
- {
- dna.push_back(num);
- }
- }
- int size = dna.size();
- Dec2Hex(firstNonRepeating(dna, size));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement