- 흠. 역시 섹션이 좀 높아지니 슬슬 애를 먹는군요  
 
- 역시 해석 삽질로;; 이상한 길로 빠졌다는;;
 
- 역시 테스트를 마니 해봐야 한다는 걸 뼈저리게 느낀 문제였다는;;
 
- 전혀 생각도 못한 경우가 튀어나와서 그걸 생각 못해준게;;
 
- 테스트 케이스에 맞춰 프로그램 고쳐나가다 보니..;; 점점 더러워졌다는;;
 
- 모범 답안은 겁나게 깔끔하던데..
 
 
~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;
}