Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- void combination(int pos,char letter)
- {
- if(pos==3)
- {
- return;
- }
- if(pos==0)
- {
- combination(pos+1,'a');
- combination(pos+1,'b');
- combination(pos+1,'c');
- }
- else
- {
- if(letter=='a')
- {
- combination(pos+1,'b');
- combination(pos+1,'c');
- }
- else if(letter=='b')
- {
- combination(pos+1,'a');
- combination(pos+1,'c');
- }
- else
- {
- combination(pos+1,'a');
- combination(pos+1,'b');
- }
- }
- }
- int main()
- {
- combination(1,'a');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement