string solution(int a ,int b, int c) { // write your code in C : Notes">

# Notes

## Notes - notes.io

// you can use includes, for example:
// #include <algorithm>

// you can write to stdout for debugging purposes, e.g.
// cout << "this is a debug message" << endl;
#include<unordered_set>
string solution(int a ,int b, int c) {
// write your code in C++14 (g++ 6.2.0)
string ans ;
// if(a/(b+c)>3 || b/(a+c)>3 || c/(a+b)>3)
// return ans;

int n = a+b+c;
unordered_set<int> m;
int i=0,j=0,k=0;
int ca = 0,cb= 0,cc = 0;
//bool fa = false,fb = false,fc = false;
int temp;
//bool flag = false;
bool bswaptoa = false,bswaptoc = false,cswaptoa = false,cswaptob = false;
if(b>= a && b>=c )
{
if(a>=c)
{temp = a;
a= b;
b= temp;
bswaptoa = true;
}
else{
temp = c;
c= b;
b= temp;
bswaptoc = true;
}
}
else if(c>=b &&c>=a )
{
if(b>=a)
{temp = a;
a= c;
c= temp;
cswaptoa = true;
}
else{
temp = b;
b= c;
c= temp;
cswaptob = true;
}
}
while((i+j+k)!=n){
if(ca<2 && i<a){
while(ca<a && ca<2 && i<a){
if(bswaptoa){
ans.push_back('b');
}
else if(cswaptoa)
{
ans.push_back('c');
}
else
ans.push_back('a');
ca++;
i++;
}

}
if(i<a){
if(j<b){
if(bswaptoc){
ans.push_back('c');
}
else if(bswaptoa){
ans.push_back('a');
}
else
ans.push_back('b');
j++;
ca = 0;
continue;
}
else if(k<c){
if(cswaptoa){
ans.push_back('a');

}
else if(cswaptob){
ans.push_back('b');
}
else
ans.push_back('c');
k++;
ca = 0;
continue;
}

}

if(cb<2&& j<b){
while(cb<b && cb<2 && j<b){
if(bswaptoc){
ans.push_back('c');
}
else if(bswaptoa){
ans.push_back('a');
}
else
ans.push_back('b');
cb++;
j++;
}

}
if(j<b){
if(k<c){
if(cswaptoa){
ans.push_back('a');

}
else if(cswaptob){
ans.push_back('b');
}
else
ans.push_back('c');
k++;
cb = 0;
continue;
}

}
if(cc<2&& k<c){
while(cc<c && cc<2 && k<c){
if(cswaptoa){
ans.push_back('a');

}
else if(cswaptob){
ans.push_back('b');
}
else
ans.push_back('c');
cc++;
k++;
}

}

if(m.find(i+j+k)!=m.end()){
break;
}
else{
m.insert(i+j+k);
}

}
//cout<<ans<<"*";
return ans;

/*for(i=0;i<n-1; ){
if(ca<a &&ca<2 && !fa){
while(ca<a &&ca<2 && !fa){
ans.push_back('a');
ca++;
i++;
}
}
else{
if(ca==a)
{
fa = true;
}
ca = 0;
}

if(cb<b&& cb<2 && !fb){
while(cb<b&& cb<2 && !fb)
{ans.push_back('b');
cb++;
i++;
}
}
else{
if(cb==b)
{
fb = true;
}
cb = 0;
}

if(cc<c&&cc<2 && !fc){
while(cc<c&&cc<2 && !fc){
ans.push_back('c');
cc++;
i++;
}
}
else{
if(cc==c)
{
fc = true;
}
cc = 0;
}
}
cout<<ans<<"*";*/
//return ans;

}

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

• * You can take a note from anywhere and any device with internet connection.
• * You can quickly share your contents without website, blog and e-mail.
• * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
• * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.

You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;

Email: [email protected]

Instagram: http://instagram.com/notes.io

Regards;
Notes.io Team

###### Long File

For written notes was greater than 18KB Unable to shorten.