38 lines
		
	
	
		
			1013 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			38 lines
		
	
	
		
			1013 B
		
	
	
	
		
			Go
		
	
	
	
	
	
|   | // For more tutorials: https://blog.learngoprogramming.com | ||
|  | // | ||
|  | // Copyright © 2018 Inanc Gumus | ||
|  | // Learn Go Programming Course | ||
|  | // License: https://creativecommons.org/licenses/by-nc-sa/4.0/ | ||
|  | // | ||
|  | 
 | ||
|  | package main | ||
|  | 
 | ||
|  | // --------------------------------------------------------- | ||
|  | // EXERCISE: Unique Words | ||
|  | // | ||
|  | //  Create a program that counts the unique words from an | ||
|  | //  input stream. | ||
|  | // | ||
|  | //  1. Feed the shakespeare.txt to your program. | ||
|  | // | ||
|  | //  2. Scan the input using a new Scanner. | ||
|  | // | ||
|  | //  3. Configure the scanner to scan for the words. | ||
|  | //     See the explanation inside the code below. | ||
|  | // | ||
|  | //  4. Count the unique words using a map. | ||
|  | // | ||
|  | // EXPECTED OUTPUT | ||
|  | //  There are 99 words, 70 of them are unique. | ||
|  | // --------------------------------------------------------- | ||
|  | 
 | ||
|  | func main() { | ||
|  | 	// Scanner can scan the lines, words, anything. | ||
|  | 	// Use the following code after creating the scanner to | ||
|  | 	// scan for the words instead. | ||
|  | 	// | ||
|  | 	// Below, I assumed that you put your scanner into the "in" variable. | ||
|  | 
 | ||
|  | 	// in.Split(bufio.ScanWords) | ||
|  | } |