basecamper's blog

By basecamper, history, 3 years ago, In English

Hello,

I am trying to solve A. Way Too Long Words in C# (I already have a solution in c++).

https://codeforces.com/problemset/problem/71/A

I used the example given in the problem section in order to check my code. If I input n = 1 and check each string individually, I get correct answers.

When n = 4 like in the example, it gives a wrong answer.

Test: #1, time: 78 ms., memory: 0 KB, exit code: 0, checker exit code: 1, verdict: WRONG_ANSWER Input 4 word localization internationalization pneumonoultramicroscopicsilicovolcanoconiosis Output word o9nn17nn42s Answer word l10n i18n p43s Checker Log wrong answer 2nd words differ — expected: 'l10n', found: 'o9nn17nn42s'

Thank you

basecamper

using System;

namespace Way_Too_Long_Words

{

class Program { static void Main(string[] args)

{
        int n;

        n = int.Parse(Console.ReadLine());

        int i = 1;

        while (i <= n)
        {
            string inputName = Console.ReadLine();

            if (inputName.Length > 10)
            {
                Console.Write(inputName[0]); Console.Write(inputName.Length - 2); Console.Write(inputName[inputName.Length - 1]);
                Console.Read();
            }
            else
            {
                Console.WriteLine(inputName);
                Console.Read();
            }

            i++;
        }
    }
}

}

Full text and comments »

  • Vote: I like it
  • -15
  • Vote: I do not like it