- ํ . ์ญ์ ์น์
์ด ์ข ๋์์ง๋ ์ฌ์ฌ ์ ๋ฅผ ๋จน๋๊ตฐ์

- ์ญ์ ํด์ ์ฝ์ง๋ก;; ์ด์ํ ๊ธธ๋ก ๋น ์ก๋ค๋;;
- ์ญ์ ํ
์คํธ๋ฅผ ๋ง๋ ํด๋ด์ผ ํ๋ค๋ ๊ฑธ ๋ผ์ ๋ฆฌ๊ฒ ๋๋ ๋ฌธ์ ์๋ค๋;;
- ์ ํ ์๊ฐ๋ ๋ชปํ ๊ฒฝ์ฐ๊ฐ ํ์ด๋์์ ๊ทธ๊ฑธ ์๊ฐ ๋ชปํด์ค๊ฒ;;
- ํ
์คํธ ์ผ์ด์ค์ ๋ง์ถฐ ํ๋ก๊ทธ๋จ ๊ณ ์ณ๋๊ฐ๋ค ๋ณด๋..;; ์ ์ ๋๋ฌ์์ก๋ค๋;;
- ๋ชจ๋ฒ ๋ต์์ ๊ฒ๋๊ฒ ๊น๋ํ๋๋ฐ..
~cpp
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream fin("beads.in");
ofstream fout("beads.out");
int len = 0;
string BeadsList;
void InputData();
void OutputData();
int Process();
const string CutAndPasteBack(const string& str, int pos);
int main()
{
InputData();
fout << Process() << endl;
fout.close();
fin.close();
return 0;
}
void InputData()
{
fin >> len;
fin >> BeadsList;
}
int Process()
{
int lnum = 0;
int rnum = 0;
int max = 0;
char cur;
string temp;
int i,j,curpos;
bool allsame = false;
for(i = 0 ; i < len ; ++i)
{
temp = CutAndPasteBack(BeadsList, i+1);
cur = temp[0];
if(cur == 'w')
{
for(j = 1 ; j < len ; ++j)
{
if(temp[j] != 'w')
{
cur = temp[j];
break;
}
}
}
for(j = 0 ;; ++j)
{
if(cur == temp[j] || temp[j] == 'w')
lnum++;
else
{
curpos = j;
break;
}
}
if(j == len)
allsame = true;
if(!allsame)
{
cur = temp[len-1];
if(cur == 'w')
{
for(j = 1 ; j < len ; ++j)
{
if(temp[len-1-j] != 'w')
{
cur = temp[len-1-j];
break;
}
}
}
for(j = 0 ; j < len - curpos ; ++j)
{
if(cur == temp[len-1-j] || temp[len-1-j] == 'w')
rnum++;
else
break;
}
}
if(max < lnum + rnum)
{
max = lnum + rnum;
}
lnum = rnum = 0;
}
return max;
}
const string CutAndPasteBack(const string& str, int pos)
{
string front(str,0,pos-1);
string back(str,pos-1,str.length());
string ret = back+front;
return ret;
}