Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool Contains(int k, int n)
- {
- int counter = 0;
- while(n != 0)
- {
- int num = n%10;
- if(num == k)
- {
- counter++;
- }
- n = n/10;
- }
- if(counter <= 2)
- return true;
- else return false;
- }
- int main()
- {
- int a,b;
- cin>>a>>b;
- cout<<Contains(a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement