Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 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 _2214
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int a, b, k = 0, ac = 0, bc = 0, c, d;
  14. a = int.Parse(Console.ReadLine());
  15. b = int.Parse(Console.ReadLine());
  16. c = a;
  17. d = b;
  18. while ( c > 0 )
  19. {
  20. c /= 10;
  21. ac++;
  22. }
  23. while ( d > 0 )
  24. {
  25. d /= 10;
  26. bc++;
  27. }
  28. if (ac == bc)
  29. {
  30. while (a > 0 && b > 0)
  31. {
  32. if (a % 10 == b % 10)
  33. {
  34. k++;
  35. }
  36. a /= 10;
  37. b /= 10;
  38. }
  39. Console.WriteLine("DA");
  40. Console.WriteLine(k);
  41.  
  42. }
  43. else
  44. Console.WriteLine("NU");
  45. Console.ReadKey();
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement