public int getmin(String Directions) {
		int min = Integer.MAX_VALUE;
		for (int j = 0; j < 2; j++) {
			charArrays = Directions.toCharArray();
			int count = 0;
			//最初と最後の文字が同じときは空白にする
			if (j == 1) {
				charArrays[0] = 0;
				count++;
			}
			for (int i = 0; i < charArrays.length; i++) {
				if (charArrays[i] == charArrays[r(i + 1)] && charArrays[i] != 0) {
					charArrays[r(i + 1)] = 0;
					count++;
				}
			}
			min = Math.min(count, min);
		}

		return min;
	}