42 lines
		
	
	
		
			961 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			42 lines
		
	
	
		
			961 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package main
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// ---------------------------------------------------------
							 | 
						||
| 
								 | 
							
								// EXERCISE: Log Parser from Stratch
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//  You've watched the lecture. Now, try to create the same
							 | 
						||
| 
								 | 
							
								//  log parser program on your own. Do not look at the lecture,
							 | 
						||
| 
								 | 
							
								//  and the existing source code.
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								// EXPECTED OUTPUT
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//  go run main.go < log.txt
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//   DOMAIN                             VISITS
							 | 
						||
| 
								 | 
							
								//   ---------------------------------------------
							 | 
						||
| 
								 | 
							
								//   blog.golang.org                        30
							 | 
						||
| 
								 | 
							
								//   golang.org                             10
							 | 
						||
| 
								 | 
							
								//   learngoprogramming.com                 20
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//   TOTAL                                  60
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//  go run main.go < log_err_missing.txt
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//   wrong input: [golang.org] (line #3)
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//  go run main.go < log_err_negative.txt
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//   wrong input: "-100" (line #3)
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//  go run main.go < log_err_str.txt
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								//   wrong input: "FOUR" (line #3)
							 | 
						||
| 
								 | 
							
								//
							 | 
						||
| 
								 | 
							
								// ---------------------------------------------------------
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func main() {
							 | 
						||
| 
								 | 
							
								}
							 |