This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
//声明FBI函数
char FBI(string s);
int main() {
int n;
cin >> n;
string s;
cin >> s;
cout << FBI(s);
return 0;
}
//FBI函数(递归函数)的实现
char FBI(string s) {
if (s.length() > 1) {
//输出左
cout << FBI(s.substr(0, s.length() / 2));
//输出右
cout << FBI(s.substr(s.length() / 2, s.length() / 2));
// http://c.biancheng.net/view/400.html
if (s == string(s.length(), '0')) return 'B'; //通过string的构造函数,构建s.length()长度的0组成的字符串
if (s == string(s.length(), '1')) return 'I';
//混搭的输出F
return 'F';