Advertisement
Guest User

Само букви

a guest
Feb 19th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace P06
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var input = Console.ReadLine();
  14.  
  15. var count = 0;
  16. var nums = "";
  17.  
  18. for (int i = 0; i < input.Length; i++)
  19. {
  20. if (char.IsDigit(input[i]))
  21. {
  22. count++;
  23. nums += input[i];
  24. }
  25. if (char.IsLetter(input[i]) && count > 0)
  26. {
  27. input = input.Replace(nums, input[i].ToString());
  28. nums = "";
  29. count = 0;
  30. }
  31.  
  32. }
  33. Console.WriteLine(input);
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement