Submission #1675546


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int main()
{
  string W;
  cin >> W;
  vector<char> vowel[5] = {'a',
                           'i',
                           'u',
                           'e',
                           'o'};
  int i = 0;
  while (i < W.length())
  {
    bool isVowel = false;
    for (int j = 0; j < vowel.size(); j++)
    {
      if (W[i] == vowel[j])
        isVowel = true;
    }
    if (isVowel)
    {
      W.erase(W.begin() + i);
    }
    else
    {
      ++i;
    }
  }

  cout << W << endl;

  return 0;
}

Submission Info

Submission Time
Task B - 罠
User aximov
Language C++14 (GCC 5.4.1)
Score 0
Code Size 583 Byte
Status CE

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:11:31: error: conversion from ‘char’ to non-scalar type ‘std::vector<char>’ requested
                            'o'};
                               ^
./Main.cpp:11:31: error: conversion from ‘char’ to non-scalar type ‘std::vector<char>’ requested
./Main.cpp:11:31: error: conversion from ‘char’ to non-scalar type ‘std::vector<char>’ requested
./Main.cpp:11:31: error: conversion from ‘char’ to non-scalar type ‘std::vector<char>’ requested
./Main.cpp:11:31: error: conversion from ‘char’ to non-scalar type ‘std::vector<char>’ requested
./Main.cpp:16:31: error: request for member ‘size’ in ‘vowel’, which is of non-class type ‘std::vector<char> [5]’
     for (int j = 0; j < vowel.size(); j++)
                               ^
./Main.cpp:18:16: error: no match for ‘operator==’ (operand types are ‘char’ and ‘std::vector<char>’)
       if (W[i] == vowel[j])
                ^
In file included from /usr/include/c++/5/unordered_set:48:0,
                 from /usr/inc...