Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <sstream>
- #include <algorithm>
- #include <vector>
- using namespace std;
- unsigned int getMinDigitAtNaturalNumber(const unsigned int natural_number)
- {
- unsigned int min_digit = natural_number % 10;
- int cutted_number = natural_number / 10;
- while(cutted_number != 0)
- {
- if((cutted_number % 10) < min_digit)
- {
- min_digit = cutted_number % 10;
- }
- cutted_number /= 10;
- }
- return min_digit;
- }
- int main() {
- unsigned int natural_number = 0;
- cin >> natural_number;
- vector <int> mas;
- int c = 0;
- int size = sizeof(mas)/sizeof(mas[0]);
- int b = getMinDigitAtNaturalNumber(natural_number);
- for(int i=0;natural_number!=0;i++)
- {mas.push_back(natural_number%10); natural_number/=10; c++;};
- int count = 0;
- for(int i=c-1;i>=0;i--)
- if(mas[i] == b && count < 1)
- {
- count++;
- }
- else {
- cout<<mas[i];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement