pastebin

Paste #82636: Untitled C++ paste by 113.108.133.42

#include <iostream>
#include <cstring>
#include <cstdio>

#define MAX 10001
#define MAXLENGTH 60

using namespace std;

int main (int argc, char *argv[])
{
  int n, maxl;
  int counter[MAX];
  char *st[MAX];
  string temp[27][MAX];

  scanf( "%d", &n );
  maxl = -1;
  memset( counter, 0, sizeof( counter ) );
  for ( int i = 0; i < n; i++ )
    st[i] = new char[MAXLENGTH];
  for ( int i = 0; i < n; i++ )
  {
    scanf( "%s", st[i] );
    printf( "%d\n", strlen(st[i] ));
    if ( strlen(st[i]) <= maxl ) {      /*magic*/
      printf("%d\n", strlen(st[i]));
      maxl = strlen(st[i]);
    }
  }
  printf( "%d\n", maxl );
  for ( int i = 0; i < n; i++ )
  {
    if ( strlen( st[i] ) < maxl )
    {
      for ( int j = strlen( st[i] ); j < maxl; j++ )
        st[i][j] = 'a' - 1;
      st[i][maxl] = '\0';
    }
  }
  for ( int i = 0; i < n; i++ )
    printf( "%s\n", st[i] );
    
  return 0;
}

Private
Wrap long lines

1 + 5 =