- ν . μμ μΉμ
μ΄ μ’ λμμ§λ μ¬μ¬ μ λ₯Ό λ¨Ήλκ΅°μ

- μμ ν΄μ μ½μ§λ‘;; μ΄μν κΈΈλ‘ λΉ μ‘λ€λ;;
- μμ ν
μ€νΈλ₯Ό λ§λ ν΄λ΄μΌ νλ€λ κ±Έ λΌμ λ¦¬κ² λλ λ¬Έμ μλ€λ;;
- μ ν μκ°λ λͺ»ν κ²½μ°κ° νμ΄λμμ κ·Έκ±Έ μκ° λͺ»ν΄μ€κ²;;
- ν
μ€νΈ μΌμ΄μ€μ λ§μΆ° νλ‘κ·Έλ¨ κ³ μ³λκ°λ€ 보λ..;; μ μ λλ¬μμ‘λ€λ;;
- λͺ¨λ² λ΅μμ κ²λκ² κΉλνλλ°..
~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;
}