Language: Java

import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		mathClass keisan = new mathClass();
		Scanner scan = new Scanner(System.in);
		String text = scan.next();
		LinkedList<Character> tikei = new LinkedList<Character>();
		LinkedList<Integer> underpos = new LinkedList<Integer>();
		ArrayList<Integer> leftpos = new ArrayList<Integer>();
		ArrayList<Integer> leftmenseki = new ArrayList<Integer>();
		ArrayList<Integer> mizuHyouji = new ArrayList<Integer>();
		int mizuAmount = 0;
		int allMizuArea = 0;
		int kyori = 0;
		int area= 0;

		//??????????????????????????§??°?????????
		for(int textpos=0; textpos<text.length(); textpos++){
			tikei.addLast(text.charAt(textpos));
		}
		for(int textpos=0; textpos<text.length(); textpos++){
			//??????????°´?????????????????????
				if(tikei.get(textpos) == '\\' ){
					underpos.addLast(textpos);
					leftpos.add(textpos);
					leftmenseki.add(0);
//					System.out.println("????????? pos "+underpos.getLast());
					inWater = true;

				}
				else if(tikei.get(textpos) == '/' ){


//					??????????????????=??????????±±?????´???
					if(underpos.size() == 0){
//						System.out.println("??????????????????");

					}
					else{
//						?????±?????????????£?????????¢?????¬???
						kyori = textpos;
						int leftnaname = underpos.pollLast();
						kyori -= leftnaname;
						area = kyori ;
//						System.out.println("?????¢??? "+area);
						int ser = leftpos.indexOf(leftnaname);
						leftmenseki.set(ser,area);

					}
				}
				else if(tikei.get(textpos) == '_' ){


				}
		}
//		System.out.println("?°´?????? "+mizuAmount+" ??¨????????¢?????? "+allMizuArea);
		int x=0;
		for (int i=0;i<leftpos.size();i++){
//			System.out.println("????????? "+leftpos.get(i)+" ??? "+leftmenseki.get(i));
			area = 0;
//			x = i;
			if(leftmenseki.get(i) == 0){
//				System.out.println("????????????????????????");
			}
			else{
				//?°´???????????????????????§??????
				if (x <leftpos.size()){
					while(true){
	//					System.out.println("X= "+x+"Y= "+y);
//						System.out.println((leftmenseki.get(i))+(leftpos.get(i)) +">"+ leftpos.get(x));
						if((leftmenseki.get(i))+(leftpos.get(i)) >= leftpos.get(x)){
//							System.out.println("?°´?????????????????¢???????¶????");
							area += leftmenseki.get(x);
							x++;
							if(x == leftpos.size()){
								break;
							}
						}
						else{
//							System.out.println("?°´??????????????????");
							break;
						}
					}
				}
			}
			if(area != 0.0){
//				System.out.println("?°´???????????£?????? i="+i);
				mizuAmount += 1;
				allMizuArea += area;
//				System.out.println("??¢?????? "+area);
				mizuHyouji.add(area);
			}
		}
//		System.out.println("????????° "+mizuAmount);
//		System.out.println("?????¢?????? "+allMizuArea);
		System.out.println(allMizuArea);
		System.out.print(mizuAmount);
		for(int i=0; i<mizuHyouji.size();i++){
			System.out.print(" "+mizuHyouji.get(i));
		}
		System.out.println("");



	}
}

class mathClass{

	public mathClass(){

	}
}

Compiler output:
Main.java:32: error: cannot find symbol
					inWater = true;
					^
  symbol:   variable inWater
  location: class Main
1 error