mirror of
				https://github.com/theoludwig/programming-challenges.git
				synced 2025-09-11 23:11:21 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			787 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			787 B
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| 
 | |
| namespace Solution
 | |
| {
 | |
|     class Program
 | |
|     {
 | |
|         static void Main()
 | |
|         {
 | |
|             string line = Console.ReadLine();
 | |
|             string result = "";
 | |
|             for (int index = 0; index < line.Length; index++)
 | |
|             {
 | |
|                 int numberOfAppearances = 0;
 | |
|                 char valueToSearch = line[index];
 | |
|                 int iteration = index;
 | |
|                 while (iteration < line.Length && line[iteration] == valueToSearch)
 | |
|                 {
 | |
|                     numberOfAppearances += 1;
 | |
|                     iteration++;
 | |
|                 }
 | |
|                 result = result + numberOfAppearances.ToString() + valueToSearch;
 | |
|                 index += numberOfAppearances - 1;
 | |
|             }
 | |
|             Console.WriteLine(result);
 | |
|         }
 | |
|     }
 | |
| }
 |