Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Code Review

$
0
0

I am trying to solve this problem on CodeForces. I came up with a solution and submitted it. However it is showing wrong answer on both testcases though it works completely fine on my system. Is anything wrong with the solution below? :

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <iostream>

using namespace std;
int main(int argc,const char *argv[]){
    string userInput;
    int t;
    scanf("%d",&t);
    while(t--){
        cin >> userInput;
        if(userInput.length()<10){
        cout << userInput << "\n";
        }
        else{
        int n = userInput.length() - 2;
        cout << userInput[0] << n << userInput[n+1] << "\n";
        }
    }
    return 0;
    }

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>