ভূমিকা
একটি স্ট্রিং দেওয়া থাকলে, তার ক্যারেক্টারগুলোকে এভাব বিন্যাস করতে হবে যাতে স্বর (vowel) ও ব্যঞ্জন (consonant) বاری বারি আসে। আপেক্ষিক ক্রম (relative order) বজায় রাখতে হবে। যদি সম্ভব না হয় তবে "not possible" প্রিন্ট করুন।
উদাহরণ
ইনপুট: "abce" → আউটপুট: "abec" (a-e vowel, b-c consonant)
C++ প্রোগ্রাম উদাহরণ
#includeusing namespace std; bool isVowel(char ch) { return ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'; } string createAlt(string s1, string s2, int start, int len) { string res = ""; for (int i=0, j=start; j = 2) return "no such string"; if (nv > nc) return vowels[0] + createAlt(cons, vowels, 1, nv); if (nc > nv) return cons[0] + createAlt(vowels, cons, 1, nc); return (cons[0] < vowels[0]) ? createAlt(cons, vowels, 0, nv) : createAlt(vowels, cons, 0, nc); } int main() { cout << findAltStr("abde") << endl; // abed return 0; }
আউটপুট
abed