The special answer


  • 0
    C
    public class Solution {
       public int countSegments(String s) {
         Scanner in = new Scanner(s);
    	int res = 0;
    	while(in.hasNext()){
    		res++;
    		String q = in.next();
    	 }
    	 return res;
         }
     }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.